3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Stdlib { use Traversable; /** * Utility class for testing and manipulation of PHP arrays. * * Declared abstract, as we have no need for instantiation. */ abstract class ArrayUtils { /** * Test whether an array contains one or more string keys * * @param mixed $value * @param bool $allowEmpty Should an empty array() return true * @return bool */ public static function hasStringKeys($value, $allowEmpty = false) { if (!is_array($value)) { return false; } if (!$value) { return $allowEmpty; } return count(array_filter(array_keys($value), 'is_string')) > 0; } /** * Test whether an array contains one or more integer keys * * @param mixed $value * @param bool $allowEmpty Should an empty array() return true * @return bool */ public static function hasIntegerKeys($value, $allowEmpty = false) { if (!is_array($value)) { return false; } if (!$value) { return $allowEmpty; } return count(array_filter(array_keys($value), 'is_int')) > 0; } /** * Test whether an array contains one or more numeric keys. * * A numeric key can be one of the following: * - an integer 1, * - a string with a number '20' * - a string with negative number: '-1000' * - a float: 2.2120, -78.150999 * - a string with float: '4000.99999', '-10.10' * * @param mixed $value * @param bool $allowEmpty Should an empty array() return true * @return bool */ public static function hasNumericKeys($value, $allowEmpty = false) { if (!is_array($value)) { return false; } if (!$value) { return $allowEmpty; } return count(array_filter(array_keys($value), 'is_numeric')) > 0; } /** * Test whether an array is a list * * A list is a collection of values assigned to continuous integer keys * starting at 0 and ending at count() - 1. * * For example: * <code> * $list = array('a', 'b', 'c', 'd'); * $list = array( * 0 => 'foo', * 1 => 'bar', * 2 => array('foo' => 'baz'), * ); * </code> * * @param mixed $value * @param bool $allowEmpty Is an empty list a valid list? * @return bool */ public static function isList($value, $allowEmpty = false) { if (!is_array($value)) { return false; } if (!$value) { return $allowEmpty; } return (array_values($value) === $value); } /** * Test whether an array is a hash table. * * An array is a hash table if: * * 1. Contains one or more non-integer keys, or * 2. Integer keys are non-continuous or misaligned (not starting with 0) * * For example: * <code> * $hash = array( * 'foo' => 15, * 'bar' => false, * ); * $hash = array( * 1995 => 'Birth of PHP', * 2009 => 'PHP 5.3.0', * 2012 => 'PHP 5.4.0', * ); * $hash = array( * 'formElement, * 'options' => array( 'debug' => true ), * ); * </code> * * @param mixed $value * @param bool $allowEmpty Is an empty array() a valid hash table? * @return bool */ public static function isHashTable($value, $allowEmpty = false) { if (!is_array($value)) { return false; } if (!$value) { return $allowEmpty; } return (array_values($value) !== $value); } /** * Checks if a value exists in an array. * * Due to "foo" == 0 === TRUE with in_array when strict = false, an option * has been added to prevent this. When $strict = 0/false, the most secure * non-strict check is implemented. if $strict = -1, the default in_array * non-strict behaviour is used. * * @param mixed $needle * @param array $haystack * @param int|bool $strict * @return bool */ public static function inArray($needle, array $haystack, $strict = false) { if (!$strict) { if (is_int($needle) || is_float($needle)) { $needle = (string) $needle; } if (is_string($needle)) { foreach ($haystack as &$h) { if (is_int($h) || is_float($h)) { $h = (string) $h; } } } } return in_array($needle, $haystack, $strict); } /** * Convert an iterator to an array. * * Converts an iterator to an array. The $recursive flag, on by default, * hints whether or not you want to do so recursively. * * @param array|Traversable $iterator The array or Traversable object to convert * @param bool $recursive Recursively check all nested structures * @throws Exception\InvalidArgumentException if $iterator is not an array or a Traversable object * @return array */ public static function iteratorToArray($iterator, $recursive = true) { if (!is_array($iterator) && !$iterator instanceof Traversable) { throw new Exception\InvalidArgumentException(__METHOD__ . ' expects an array or Traversable object'); } if (!$recursive) { if (is_array($iterator)) { return $iterator; } return iterator_to_array($iterator); } if (method_exists($iterator, 'toArray')) { return $iterator->toArray(); } $array = array(); foreach ($iterator as $key => $value) { if (is_scalar($value)) { $array[$key] = $value; continue; } if ($value instanceof Traversable) { $array[$key] = static::iteratorToArray($value, $recursive); continue; } if (is_array($value)) { $array[$key] = static::iteratorToArray($value, $recursive); continue; } $array[$key] = $value; } return $array; } /** * Merge two arrays together. * * If an integer key exists in both arrays, the value from the second array * will be appended the the first array. If both values are arrays, they * are merged together, else the value of the second array overwrites the * one of the first array. * * @param array $a * @param array $b * @return array */ public static function merge(array $a, array $b) { foreach ($b as $key => $value) { if (array_key_exists($key, $a)) { if (is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = static::merge($a[$key], $value); } else { $a[$key] = $value; } } else { $a[$key] = $value; } } return $a; } } } namespace Zend\Crypt\Password { interface PasswordInterface { /** * Create a password hash for a given plain text password * * @param string $password The password to hash * @return string The formatted password hash */ public function create($password); /** * Verify a password hash against a given plain text password * * @param string $password The password to hash * @param string $hash The supplied hash to validate * @return bool Does the password validate against the hash */ public function verify($password, $hash); } } /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Math\Exception { class RuntimeException extends \Exception {} } namespace Zend\Math { use RandomLib; /** * Pseudorandom number generator (PRNG) */ abstract class Rand { /** * Alternative random byte generator using RandomLib * * @var RandomLib\Generator */ protected static $generator = null; /** * Generate random bytes using OpenSSL or Mcrypt and mt_rand() as fallback * * @param int $length * @param bool $strong true if you need a strong random generator (cryptography) * @return string * @throws Exception\RuntimeException */ public static function getBytes($length, $strong = false) { if ($length <= 0) { return false; } $bytes = ''; if (function_exists('openssl_random_pseudo_bytes') && (version_compare(PHP_VERSION, '5.3.4') >= 0 || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') ) { $bytes = openssl_random_pseudo_bytes($length, $usable); if (true === $usable) { return $bytes; } } if (function_exists('mcrypt_create_iv') && (version_compare(PHP_VERSION, '5.3.7') >= 0 || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') ) { $bytes = mcrypt_create_iv($length, MCRYPT_DEV_URANDOM); if ($bytes !== false && strlen($bytes) === $length) { return $bytes; } } $checkAlternatives = (file_exists('/dev/urandom') && is_readable('/dev/urandom')) || class_exists('\\COM', false); if (true === $strong && false === $checkAlternatives) { throw new Exception\RuntimeException ( 'This PHP environment doesn\'t support secure random number generation. ' . 'Please consider installing the OpenSSL and/or Mcrypt extensions' ); } $generator = self::getAlternativeGenerator(); return $generator->generate($length); } /** * Retrieve a fallback/alternative RNG generator * * @return RandomLib\Generator */ public static function getAlternativeGenerator() { if (!is_null(static::$generator)) { return static::$generator; } if (!class_exists('RandomLib\\Factory')) { throw new Exception\RuntimeException( 'The RandomLib fallback pseudorandom number generator (PRNG) ' . ' must be installed in the absence of the OpenSSL and ' . 'Mcrypt extensions' ); } $factory = new RandomLib\Factory; $factory->registerSource( 'HashTiming', 'Zend\Math\Source\HashTiming' ); static::$generator = $factory->getMediumStrengthGenerator(); return static::$generator; } /** * Generate random boolean * * @param bool $strong true if you need a strong random generator (cryptography) * @return bool */ public static function getBoolean($strong = false) { $byte = static::getBytes(1, $strong); return (bool) (ord($byte) % 2); } /** * Generate a random integer between $min and $max * * @param int $min * @param int $max * @param bool $strong true if you need a strong random generator (cryptography) * @return int * @throws Exception\DomainException */ public static function getInteger($min, $max, $strong = false) { if ($min > $max) { throw new Exception\DomainException( 'The min parameter must be lower than max parameter' ); } $range = $max - $min; if ($range == 0) { return $max; } elseif ($range > PHP_INT_MAX || is_float($range)) { throw new Exception\DomainException( 'The supplied range is too great to generate' ); } $log = log($range, 2); $bytes = (int) ($log / 8) + 1; $bits = (int) $log + 1; $filter = (int) (1 << $bits) - 1; do { $rnd = hexdec(bin2hex(self::getBytes($bytes, $strong))); $rnd = $rnd & $filter; } while ($rnd > $range); return ($min + $rnd); } /** * Generate random float (0..1) * This function generates floats with platform-dependent precision * * PHP uses double precision floating-point format (64-bit) which has * 52-bits of significand precision. We gather 7 bytes of random data, * and we fix the exponent to the bias (1023). In this way we generate * a float of 1.mantissa. * * @param bool $strong true if you need a strong random generator (cryptography) * @return float */ public static function getFloat($strong = false) { $bytes = static::getBytes(7, $strong); $bytes[6] = $bytes[6] | chr(0xF0); $bytes .= chr(63); // exponent bias (1023) list(, $float) = unpack('d', $bytes); return ($float - 1); } /** * Generate a random string of specified length. * * Uses supplied character list for generating the new string. * If no character list provided - uses Base 64 character set. * * @param int $length * @param string|null $charlist * @param bool $strong true if you need a strong random generator (cryptography) * @return string * @throws Exception\DomainException */ public static function getString($length, $charlist = null, $strong = false) { if ($length < 1) { throw new Exception\DomainException('Length should be >= 1'); } // charlist is empty or not provided if (empty($charlist)) { $numBytes = ceil($length * 0.75); $bytes = static::getBytes($numBytes, $strong); return substr(rtrim(base64_encode($bytes), '='), 0, $length); } $listLen = strlen($charlist); if ($listLen == 1) { return str_repeat($charlist, $length); } $bytes = static::getBytes($length, $strong); $pos = 0; $result = ''; for ($i = 0; $i < $length; $i++) { $pos = ($pos + ord($bytes[$i])) % $listLen; $result .= $charlist[$pos]; } return $result; } } } /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Crypt\Password { use Traversable; use Zend\Math\Rand; use Zend\Stdlib\ArrayUtils; /** * Bcrypt algorithm using crypt() function of PHP */ class Bcrypt implements PasswordInterface { const MIN_SALT_SIZE = 16; /** * @var string */ protected $cost = '14'; /** * @var string */ protected $salt; /** * @var bool */ protected $backwardCompatibility = false; /** * Constructor * * @param array|Traversable $options * @throws Exception\InvalidArgumentException */ public function __construct($options = array()) { if (!empty($options)) { if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } elseif (!is_array($options)) { throw new Exception\InvalidArgumentException( 'The options parameter must be an array or a Traversable' ); } foreach ($options as $key => $value) { switch (strtolower($key)) { case 'salt': $this->setSalt($value); break; case 'cost': $this->setCost($value); break; } } } } /** * Bcrypt * * @param string $password * @throws Exception\RuntimeException * @return string */ public function create($password) { if (empty($this->salt)) { $salt = Rand::getBytes(self::MIN_SALT_SIZE); } else { $salt = $this->salt; } $salt64 = substr(str_replace('+', '.', base64_encode($salt)), 0, 22); /** * Check for security flaw in the bcrypt implementation used by crypt() * @see http://php.net/security/crypt_blowfish.php */ if ((version_compare(PHP_VERSION, '5.3.7') >= 0) && !$this->backwardCompatibility) { $prefix = '$2y$'; } else { $prefix = '$2a$'; // check if the password contains 8-bit character if (preg_match('/[\x80-\xFF]/', $password)) { throw new Exception\RuntimeException( 'The bcrypt implementation used by PHP can contain a security flaw ' . 'using password with 8-bit character. ' . 'We suggest to upgrade to PHP 5.3.7+ or use passwords with only 7-bit characters' ); } } $hash = crypt($password, $prefix . $this->cost . '$' . $salt64); if (strlen($hash) < 13) { throw new Exception\RuntimeException('Error during the bcrypt generation'); } return $hash; } /** * Verify if a password is correct against an hash value * * @param string $password * @param string $hash * @throws Exception\RuntimeException when the hash is unable to be processed * @return bool */ public function verify($password, $hash) { $result = crypt($password, $hash); if ($result === $hash) { return true; } if (strlen($result) <= 13) { /* This should only happen if the algorithm that generated hash is * either unsupported by this version of crypt(), or is invalid. * * An example of when this can happen, is if you generate * non-backwards-compatible hashes on 5.3.7+, and then try to verify * them on < 5.3.7. * * This is needed, because version comparisons are not possible due * to back-ported functionality by some distributions. */ throw new Exception\RuntimeException( 'The supplied password hash could not be verified. Please check ' . 'backwards compatibility settings.' ); } return false; } /** * Set the cost parameter * * @param int|string $cost * @throws Exception\InvalidArgumentException * @return Bcrypt */ public function setCost($cost) { if (!empty($cost)) { $cost = (int) $cost; if ($cost < 4 || $cost > 31) { throw new Exception\InvalidArgumentException( 'The cost parameter of bcrypt must be in range 04-31' ); } $this->cost = sprintf('%1$02d', $cost); } return $this; } /** * Get the cost parameter * * @return string */ public function getCost() { return $this->cost; } /** * Set the salt value * * @param string $salt * @throws Exception\InvalidArgumentException * @return Bcrypt */ public function setSalt($salt) { if (strlen($salt) < self::MIN_SALT_SIZE) { throw new Exception\InvalidArgumentException( 'The length of the salt must be at least ' . self::MIN_SALT_SIZE . ' bytes' ); } $this->salt = $salt; return $this; } /** * Get the salt value * * @return string */ public function getSalt() { return $this->salt; } /** * Set the backward compatibility $2a$ instead of $2y$ for PHP 5.3.7+ * * @param bool $value * @return Bcrypt */ public function setBackwardCompatibility($value) { $this->backwardCompatibility = (bool) $value; return $this; } /** * Get the backward compatibility * * @return bool */ public function getBackwardCompatibility() { return $this->backwardCompatibility; } } } namespace MyStuff { try { $key = '123456'; echo "{$key}<br />"; $crypt = new \Zend\Crypt\Password\Bcrypt(); $crypt->setCost(14); $hash = $crypt->create($key); echo "{$hash}<br />"; var_dump($crypt->verify($key, $hash)); } catch (\Exception $e) { echo $e->getMessage(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 26
Branch analysis from position: 26
2 jumps found. (Code = 107) Position 1 = 27, Position 2 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6dXh
function name:  (null)
number of ops:  31
compiled vars:  !0 = $key, !1 = $crypt, !2 = $hash, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  530     0  E >   DECLARE_CLASS                                            'zend%5Ccrypt%5Cpassword%5Cbcrypt'
  735     1        ASSIGN                                                   !0, '123456'
  736     2        NOP                                                      
          3        FAST_CONCAT                                      ~5      !0, '%3Cbr+%2F%3E'
          4        ECHO                                                     ~5
  738     5        NEW                                              $6      'Zend%5CCrypt%5CPassword%5CBcrypt'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
  739     8        INIT_METHOD_CALL                                         !1, 'setCost'
          9        SEND_VAL_EX                                              14
         10        DO_FCALL                                      0          
  740    11        INIT_METHOD_CALL                                         !1, 'create'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !2, $10
  741    15        NOP                                                      
         16        FAST_CONCAT                                      ~12     !2, '%3Cbr+%2F%3E'
         17        ECHO                                                     ~12
  743    18        INIT_NS_FCALL_BY_NAME                                    'MyStuff%5Cvar_dump'
         19        INIT_METHOD_CALL                                         !1, 'verify'
         20        SEND_VAR_EX                                              !0
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0  $13     
         23        SEND_VAR_NO_REF_EX                                       $13
         24        DO_FCALL                                      0          
         25      > JMP                                                      ->30
  744    26  E > > CATCH                                       last         'Exception'
  745    27    >   INIT_METHOD_CALL                                         !3, 'getMessage'
         28        DO_FCALL                                      0  $15     
         29        ECHO                                                     $15
  747    30    > > RETURN                                                   1

Class Zend\Stdlib\ArrayUtils:
Function hasstringkeys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6dXh
function name:  hasStringKeys
number of ops:  24
compiled vars:  !0 = $value, !1 = $allowEmpty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   29     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->8
   30     7    > > RETURN                                                   <false>
   33     8    >   BOOL_NOT                                         ~4      !0
          9      > JMPZ                                                     ~4, ->11
   34    10    > > RETURN                                                   !1
   37    11    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Ccount'
         12        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_filter'
         13        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_keys'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $5      
         16        SEND_VAR_NO_REF_EX                                       $5
         17        SEND_VAL_EX                                              'is_string'
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR_NO_REF_EX                                       $6
         20        DO_FCALL                                      0  $7      
         21        IS_SMALLER                                       ~8      0, $7
         22      > RETURN                                                   ~8
   38    23*     > RETURN                                                   null

End of function hasstringkeys

Function hasintegerkeys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6dXh
function name:  hasIntegerKeys
number of ops:  24
compiled vars:  !0 = $value, !1 = $allowEmpty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   49     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->8
   50     7    > > RETURN                                                   <false>
   53     8    >   BOOL_NOT                                         ~4      !0
          9      > JMPZ                                                     ~4, ->11
   54    10    > > RETURN                                                   !1
   57    11    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Ccount'
         12        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_filter'
         13        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_keys'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $5      
         16        SEND_VAR_NO_REF_EX                                       $5
         17        SEND_VAL_EX                                              'is_int'
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR_NO_REF_EX                                       $6
         20        DO_FCALL                                      0  $7      
         21        IS_SMALLER                                       ~8      0, $7
         22      > RETURN                                                   ~8
   58    23*     > RETURN                                                   null

End of function hasintegerkeys

Function hasnumerickeys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6dXh
function name:  hasNumericKeys
number of ops:  24
compiled vars:  !0 = $value, !1 = $allowEmpty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   74     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
   76     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->8
   77     7    > > RETURN                                                   <false>
   80     8    >   BOOL_NOT                                         ~4      !0
          9      > JMPZ                                                     ~4, ->11
   81    10    > > RETURN                                                   !1
   84    11    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Ccount'
         12        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_filter'
         13        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_keys'
         14        SEND_VAR_EX                                              !0
         15        DO_FCALL                                      0  $5      
         16        SEND_VAR_NO_REF_EX                                       $5
         17        SEND_VAL_EX                                              'is_numeric'
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR_NO_REF_EX                                       $6
         20        DO_FCALL                                      0  $7      
         21        IS_SMALLER                                       ~8      0, $7
         22      > RETURN                                                   ~8
   85    23*     > RETURN                                                   null

End of function hasnumerickeys

Function islist:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6dXh
function name:  isList
number of ops:  17
compiled vars:  !0 = $value, !1 = $allowEmpty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  107     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
  109     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->8
  110     7    > > RETURN                                                   <false>
  113     8    >   BOOL_NOT                                         ~4      !0
          9      > JMPZ                                                     ~4, ->11
  114    10    > > RETURN                                                   !1
  117    11    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_values'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $5      
         14        IS_IDENTICAL                                     ~6      !0, $5
         15      > RETURN                                                   ~6
  118    16*     > RETURN                                                   null

End of function islist

Function ishashtable:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j6dXh
function name:  isHashTable
number of ops:  17
compiled vars:  !0 = $value, !1 = $allowEmpty
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  149     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
  151     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->8
  152     7    > > RETURN                                                   <false>
  155     8    >   BOOL_NOT                                         ~4      !0
          9      > JMPZ                                                     ~4, ->11
  156    10    > > RETURN                                                   !1
  159    11    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_values'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0  $5      
         14        IS_NOT_IDENTICAL                                 ~6      !0, $5
         15      > RETURN                                                   ~6
  160    16*     > RETURN                                                   null

End of function ishashtable

Function inarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 35
Branch analysis from position: 5
2 jumps found. (Code = 47) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 35
Branch analysis from position: 20
2 jumps found. (Code = 125) Position 1 = 21, Position 2 = 34
Branch analysis from position: 21
2 jumps found. (Code = 126) Position 1 = 22, Position 2 = 34
Branch analysis from position: 22
2 jumps found. (Code = 47) Position 1 = 26, Position 2 = 30
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 33
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 33
Branch analysis from position: 30
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 35
Branch analysis from position: 16
Branch analysis from position: 13
Branch analysis from position: 35
filename:       /in/j6dXh
function name:  inArray
number of ops:  42
compiled vars:  !0 = $needle, !1 = $haystack, !2 = $strict, !3 = $h
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  175     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
  177     3        BOOL_NOT                                         ~4      !2
          4      > JMPZ                                                     ~4, ->35
  178     5    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_int'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $5      
          8      > JMPNZ_EX                                         ~6      $5, ->13
          9    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_float'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0  $7      
         12        BOOL                                             ~6      $7
         13    > > JMPZ                                                     ~6, ->16
  179    14    >   CAST                                          6  ~8      !0
         15        ASSIGN                                                   !0, ~8
  181    16    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_string'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0  $10     
         19      > JMPZ                                                     $10, ->35
  182    20    > > FE_RESET_RW                                      $11     !1, ->34
         21    > > FE_FETCH_RW                                              $11, !3, ->34
  183    22    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_int'
         23        SEND_VAR_EX                                              !3
         24        DO_FCALL                                      0  $12     
         25      > JMPNZ_EX                                         ~13     $12, ->30
         26    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_float'
         27        SEND_VAR_EX                                              !3
         28        DO_FCALL                                      0  $14     
         29        BOOL                                             ~13     $14
         30    > > JMPZ                                                     ~13, ->33
  184    31    >   CAST                                          6  ~15     !3
         32        ASSIGN                                                   !3, ~15
  182    33    > > JMP                                                      ->21
         34    >   FE_FREE                                                  $11
  189    35    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cin_array'
         36        SEND_VAR_EX                                              !0
         37        SEND_VAR_EX                                              !1
         38        SEND_VAR_EX                                              !2
         39        DO_FCALL                                      0  $17     
         40      > RETURN                                                   $17
  190    41*     > RETURN                                                   null

End of function inarray

Function iteratortoarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 34
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 77) Position 1 = 36, Position 2 = 68
Branch analysis from position: 36
2 jumps found. (Code = 78) Position 1 = 37, Position 2 = 68
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 45
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 54
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 65
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
Branch analysis from position: 10
filename:       /in/j6dXh
function name:  iteratorToArray
number of ops:  71
compiled vars:  !0 = $iterator, !1 = $recursive, !2 = $array, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  203     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <true>
  205     2        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $5      
          5        BOOL_NOT                                         ~6      $5
          6      > JMPZ_EX                                          ~6      ~6, ->10
          7    >   INSTANCEOF                                       ~7      !0, 'Traversable'
          8        BOOL_NOT                                         ~8      ~7
          9        BOOL                                             ~6      ~8
         10    > > JMPZ                                                     ~6, ->15
  206    11    >   NEW                                              $9      'Zend%5CStdlib%5CException%5CInvalidArgumentException'
         12        SEND_VAL_EX                                              'Zend%5CStdlib%5CArrayUtils%3A%3AiteratorToArray+expects+an+array+or+Traversable+object'
         13        DO_FCALL                                      0          
         14      > THROW                                         0          $9
  209    15    >   BOOL_NOT                                         ~11     !1
         16      > JMPZ                                                     ~11, ->26
  210    17    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0  $12     
         20      > JMPZ                                                     $12, ->22
  211    21    > > RETURN                                                   !0
  214    22    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Citerator_to_array'
         23        SEND_VAR_EX                                              !0
         24        DO_FCALL                                      0  $13     
         25      > RETURN                                                   $13
  217    26    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cmethod_exists'
         27        SEND_VAR_EX                                              !0
         28        SEND_VAL_EX                                              'toArray'
         29        DO_FCALL                                      0  $14     
         30      > JMPZ                                                     $14, ->34
  218    31    >   INIT_METHOD_CALL                                         !0, 'toArray'
         32        DO_FCALL                                      0  $15     
         33      > RETURN                                                   $15
  221    34    >   ASSIGN                                                   !2, <array>
  222    35      > FE_RESET_R                                       $17     !0, ->68
         36    > > FE_FETCH_R                                       ~18     $17, !3, ->68
         37    >   ASSIGN                                                   !4, ~18
  223    38        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_scalar'
         39        SEND_VAR_EX                                              !3
         40        DO_FCALL                                      0  $20     
         41      > JMPZ                                                     $20, ->45
  224    42    >   ASSIGN_DIM                                               !2, !4
         43        OP_DATA                                                  !3
  225    44      > JMP                                                      ->36
  228    45    >   INSTANCEOF                                               !3, 'Traversable'
         46      > JMPZ                                                     ~22, ->54
  229    47    >   INIT_STATIC_METHOD_CALL                                  'iteratorToArray'
         48        SEND_VAR_EX                                              !3
         49        SEND_VAR_EX                                              !1
         50        DO_FCALL                                      0  $24     
         51        ASSIGN_DIM                                               !2, !4
         52        OP_DATA                                                  $24
  230    53      > JMP                                                      ->36
  233    54    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
         55        SEND_VAR_EX                                              !3
         56        DO_FCALL                                      0  $25     
         57      > JMPZ                                                     $25, ->65
  234    58    >   INIT_STATIC_METHOD_CALL                                  'iteratorToArray'
         59        SEND_VAR_EX                                              !3
         60        SEND_VAR_EX                                              !1
         61        DO_FCALL                                      0  $27     
         62        ASSIGN_DIM                                               !2, !4
         63        OP_DATA                                                  $27
  235    64      > JMP                                                      ->36
  238    65    >   ASSIGN_DIM                                               !2, !4
         66        OP_DATA                                                  !3
  222    67      > JMP                                                      ->36
         68    >   FE_FREE                                                  $17
  241    69      > RETURN                                                   !2
  242    70*     > RETURN                                                   null

End of function iteratortoarray

Function merge:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 43
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 43
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 40
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 37
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 27
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
filename:       /in/j6dXh
function name:  merge
number of ops:  46
compiled vars:  !0 = $a, !1 = $b, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  256     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  258     2      > FE_RESET_R                                       $4      !1, ->43
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->43
          4    >   ASSIGN                                                   !3, ~5
  259     5        INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Carray_key_exists'
          6        SEND_VAR_EX                                              !3
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $7      
          9      > JMPZ                                                     $7, ->40
  260    10    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_int'
         11        SEND_VAR_EX                                              !3
         12        DO_FCALL                                      0  $8      
         13      > JMPZ                                                     $8, ->17
  261    14    >   ASSIGN_DIM                                               !0
         15        OP_DATA                                                  !2
         16      > JMP                                                      ->39
  262    17    >   INIT_NS_FCALL_BY_NAME                                    'Zend%5CStdlib%5Cis_array'
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                         

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
369.59 ms | 1420 KiB | 43 Q