global statement removal: hphp/test [7/x]
[hiphop-php.git] / hphp / test / quick / rename_function.php
blob4b81ea683ce6bd55f479c1ed8187df15208bd97f
1 <?hh
3 function one() {
4 echo "one\n";
7 function three() {
8 echo "three\n";
11 one();
12 var_dump(fb_rename_function("one", "two"));
13 two();
14 var_dump(fb_rename_function("three", "one"));
15 one();
17 abstract final class MyMicrotimeStatics {
18 public static $x = 0.0;
21 // Try it with a builtin, too.
23 function my_microtime(bool $foob = false) {
24 echo "ca\$h m0n3y\n";
25 MyMicrotimeStatics::$x += 1.0;
26 if (false) {
27 return MyMicrotimeStatics::$x;
29 return (string)MyMicrotimeStatics::$x;
32 var_dump(fb_rename_function('microtime', '__dont_call_microtime'));
33 var_dump(fb_rename_function('my_microtime', 'microtime'));
34 echo microtime(true) . "\n";
36 function my_foo() {}
38 function bar() {
39 $orig = "foo";
40 $new = "my_$orig";
41 var_dump(fb_rename_function($new, "foo"));
44 bar();