3v4l.org

run code in 300+ PHP versions simultaneously
<?php function filterLabel($label) { $filtered = key(array(trim($label) => 1)); if ($filtered === false) { throw new UnexpectedValueException('Unable to filter %s', var_export($label, true)); } return $filtered; } $data = array("foo", "0foo", 0, "0", "00", 1, NULL, FALSE, new SimpleXMLElement('<root />')); foreach ($data as $index => $label) { printf("==== %d ====\n", $index); var_dump($label, filterLabel($label)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 28
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 28
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/ZEQdJ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $data, !1 = $label, !2 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_ARRAY                                       ~3      'foo'
          1        ADD_ARRAY_ELEMENT                                ~3      '0foo'
          2        ADD_ARRAY_ELEMENT                                ~3      0
          3        ADD_ARRAY_ELEMENT                                ~3      '0'
          4        ADD_ARRAY_ELEMENT                                ~3      '00'
          5        ADD_ARRAY_ELEMENT                                ~3      1
          6        ADD_ARRAY_ELEMENT                                ~3      null
          7        ADD_ARRAY_ELEMENT                                ~3      <false>
          8        NEW                                              $4      'SimpleXMLElement'
          9        SEND_VAL_EX                                              '%3Croot+%2F%3E'
         10        DO_FCALL                                      0          
         11        ADD_ARRAY_ELEMENT                                ~3      $4
         12        ASSIGN                                                   !0, ~3
   17    13      > FE_RESET_R                                       $7      !0, ->28
         14    > > FE_FETCH_R                                       ~8      $7, !1, ->28
         15    >   ASSIGN                                                   !2, ~8
   18    16        INIT_FCALL                                               'printf'
         17        SEND_VAL                                                 '%3D%3D%3D%3D+%25d+%3D%3D%3D%3D%0A'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   19    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !1
         22        INIT_FCALL                                               'filterlabel'
         23        SEND_VAR                                                 !1
         24        DO_FCALL                                      0  $11     
         25        SEND_VAR                                                 $11
         26        DO_ICALL                                                 
   17    27      > JMP                                                      ->14
         28    >   FE_FREE                                                  $7
   20    29      > RETURN                                                   1

Function filterlabel:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZEQdJ
function name:  filterLabel
number of ops:  22
compiled vars:  !0 = $label, !1 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'key'
          2        INIT_FCALL                                               'trim'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        INIT_ARRAY                                       ~3      1, $2
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
    7     9        TYPE_CHECK                                    4          !1
         10      > JMPZ                                                     ~6, ->20
    8    11    >   NEW                                              $7      'UnexpectedValueException'
         12        SEND_VAL_EX                                              'Unable+to+filter+%25s'
         13        INIT_FCALL                                               'var_export'
         14        SEND_VAR                                                 !0
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $8      
         17        SEND_VAR_NO_REF_EX                                       $8
         18        DO_FCALL                                      0          
         19      > THROW                                         0          $7
   11    20    > > RETURN                                                   !1
   12    21*     > RETURN                                                   null

End of function filterlabel

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.12 ms | 1402 KiB | 24 Q