3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isStringOrNumeric($in) { return basename($in); } function test($carry, $value) { $carry[] = basename($value); return $carry; } $a = array( 'index.php', '../../../index.php', 'valami.txt'); var_dump(array_filter($a, 'test')); /*$b = array_filter($a, 'isStringOrNumeric'); var_dump($a); var_dump($b);*/ if($b === $a) echo('Success!'); else echo('Fail!');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BteP1
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'test'
          5        DO_ICALL                                         $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   17     8        IS_IDENTICAL                                             !1, !0
          9      > JMPZ                                                     ~5, ->12
   18    10    >   ECHO                                                     'Success%21'
         11      > JMP                                                      ->13
   20    12    >   ECHO                                                     'Fail%21'
         13    > > RETURN                                                   1

Function isstringornumeric:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BteP1
function name:  isStringOrNumeric
number of ops:  6
compiled vars:  !0 = $in
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'basename'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    4     5*     > RETURN                                                   null

End of function isstringornumeric

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BteP1
function name:  test
number of ops:  9
compiled vars:  !0 = $carry, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'basename'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $3      
          5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  $3
    8     7      > RETURN                                                   !0
    9     8*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.14 ms | 1388 KiB | 19 Q