Skip to content

Commit

Permalink
adding new examples for dynamic staatic methods, callStatic. renaming…
Browse files Browse the repository at this point in the history
… files away from "example*" to something more meaningful
  • Loading branch information
enygma committed Nov 11, 2010
1 parent d4e11e2 commit ca48875
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
21 changes: 21 additions & 0 deletions misc/example-callStatic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* An example of using the __callStatic method to catch undefined
* static method calls
*/

class Sample
{
/* no static methods defiled */

public static function __callStatic($functionName,$arguments)
{
echo $functionName."\n";
var_dump($arguments);
}
}

Sample::test();

?>
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions misc/example-dynamicStaticMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

class Sample
{
public static function test()
{
echo "In ".__CLASS__."\n";
}
}

class Sample1
{
public static function test()
{
echo "In ".__CLASS__."\n";
}
}

$name = 'Sample';
$name::test();

$name = 'Sample1';
$name::test();

?>
File renamed without changes.
File renamed without changes.

0 comments on commit ca48875

Please sign in to comment.