Index: trunk/extensions/Wikidata/OmegaWiki/small/functionvar.php |
— | — | @@ -1,21 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -class bla { |
5 | | - |
6 | | - |
7 | | - static function a( $hello ) { |
8 | | - echo $hello; |
9 | | - } |
10 | | - |
11 | | - function b() { |
12 | | - $a = "a"; |
13 | | - $x = $this->$a; |
14 | | - $x( "hello world" ); |
15 | | - } |
16 | | -} |
17 | | - |
18 | | -$c = new bla(); |
19 | | -$c->b(); |
20 | | - |
21 | | - |
22 | | -?> |
Index: trunk/extensions/Wikidata/OmegaWiki/small/overload.php |
— | — | @@ -1,21 +0,0 @@ |
2 | | -<?PHP |
3 | | - |
4 | | - |
5 | | -class bla { |
6 | | - protected $foo = array(); |
7 | | - |
8 | | - function __set( $key, $value ) { |
9 | | - $this->foo[$key] = $value; |
10 | | - } |
11 | | - |
12 | | - function __get( $key ) { |
13 | | - return $this->foo[$key]; |
14 | | - } |
15 | | -} |
16 | | - |
17 | | -$b = new bla(); |
18 | | -$baz = "bar"; |
19 | | -$b->$baz = "hello"; |
20 | | -echo $b->bar; |
21 | | - |
22 | | -?> |
Index: trunk/extensions/Wikidata/OmegaWiki/small/staticarray.php |
— | — | @@ -1,20 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -function sarray( $key, $value = null ) { |
5 | | - static $foo = array(); |
6 | | - if ( is_null( $value ) ) |
7 | | - return $foo[$key]; |
8 | | - $foo[$key] = $value; |
9 | | - return $foo[$key]; |
10 | | -} |
11 | | - |
12 | | - |
13 | | - |
14 | | -sarray( "bla", "blie" ); |
15 | | -sarray( "ready", "aim" ); |
16 | | -sarray( "fie", "fie" ); |
17 | | -sarray( "aim", "fire" ); |
18 | | -sarray( "ready", "teddy" ); // ready twice |
19 | | -print sarray( "ready" ) . " " . sarray( "aim" ); |
20 | | - |
21 | | -?> |