/tests/php/ia/call_user_func.php

https://github.com/llvm-djk/pfff · PHP · 23 lines · 11 code · 6 blank · 6 comment · 0 complexity · ba8c87e190995de8dc460efb6fe4e208 MD5 · raw file

  1. <?php
  2. function foo($x) {
  3. var_dump($x);
  4. }
  5. function bar($x) {
  6. var_dump($x);
  7. }
  8. $t = 'foo';
  9. // this one will be ok
  10. call_user_func($t, 5);
  11. //APPROX:
  12. // this one will not because $t will have been generalized to a Tstring
  13. //$t = 'bar';
  14. //call_user_func($t, 6);
  15. // this is ok because it's another variable
  16. $t2 = 'bar';
  17. call_user_func($t2, 6);