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, "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/TTdCX
function name:  (null)
number of ops:  30
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      '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
   20    13      > FE_RESET_R                                       $7      !0, ->28
         14    > > FE_FETCH_R                                       ~8      $7, !1, ->28
         15    >   ASSIGN                                                   !2, ~8
   21    16        INIT_FCALL                                               'printf'
         17        SEND_VAL                                                 '%3D%3D%3D%3D+%25d+%3D%3D%3D%3D%0A'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
   22    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                                                 
   20    27      > JMP                                                      ->14
         28    >   FE_FREE                                                  $7
   23    29      > 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/TTdCX
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:
153.29 ms | 1403 KiB | 24 Q