3v4l.org

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

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

End of function filterlabel

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.95 ms | 1403 KiB | 24 Q