PHP userland backwards compatibility layer that emulates PHP 5.5+ core functions.

⌈⌋ branch:  upgrade.php


Artifact [fb82478e25]

Artifact fb82478e252d5054a0f59e24e07e6517635c735f:

  • Executable file doc/devtools/php-commandline/PhpFunctionCall — part of check-in [51e3884900] at 2010-06-22 17:03:27 on branch trunk — upgradephp-15 (user: mario size: 478)
  • Executable file dtools/php-commandline/PhpFunctionCall — part of check-in [39c9fa23ab] at 2010-06-22 17:03:23 on branch trunk — upgradephp-14 (user: mario size: 478)

#!/usr/bin/php -qC
<?php

   #-- function name
   $func = $_SERVER["argv"][0];
   $func = substr($func, strrpos($func, "/") + 1);

   #-- args
   $args = $_SERVER["argv"];
   array_shift($args);

   #-- stdin as arg
   if (!count($args)) {
      if (($f = fopen("php://stdin", "rb"))
      and ($input = fread($f, 1<<22))) {
         array_unshift($args, $input);
         fclose($f);
      }
   }

   #-- do
   $output = call_user_func_array($func, $args);
   echo $output;

?>