Skip to content

Instantly share code, notes, and snippets.

@mhulse
Last active December 22, 2015 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhulse/6441525 to your computer and use it in GitHub Desktop.
Save mhulse/6441525 to your computer and use it in GitHub Desktop.
PHP simple utility class demo code.
<?php
class Utility
{
public static function foo($arg = '') {
echo sprintf('<p>This class is "%s"; it\'s method is "%s"; the arg is "%s"</p>', get_class($this), __FUNCTION__, $arg);
}
public static function bar($arg = '') {
echo sprintf('<p>This class is "%s"; it\'s method is "%s"; the arg is "%s"</p>', get_class($this), __FUNCTION__, $arg);
}
}
Utility::foo('Hello');
Utility::bar('world');
Utility::foo('!');
/*
Output:
This class is "Utility"; it's method is "foo"; the arg is "Hello"
This class is "Utility"; it's method is "bar"; the arg is "world"
This class is "Utility"; it's method is "foo"; the arg is "!"
*/
@mhulse
Copy link
Author

mhulse commented Sep 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment