3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cast($val) { if (is_numeric($val)) { return $val + 0; } //return 0; return $val; } $arr = ['stri33ng123', 84, 76.7, '45.6', '67.5e45', '56,9']; array_walk($arr , 'cast'); foreach($arr as $a) { var_dump(cast($a)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/2s7tV
function name:  (null)
number of ops:  16
compiled vars:  !0 = $arr, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'array_walk'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'cast'
          4        DO_ICALL                                                 
   24     5      > FE_RESET_R                                       $4      !0, ->14
          6    > > FE_FETCH_R                                               $4, !1, ->14
   25     7    >   INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'cast'
          9        SEND_VAR                                                 !1
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
   24    13      > JMP                                                      ->6
         14    >   FE_FREE                                                  $4
   27    15      > RETURN                                                   1

Function cast:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2s7tV
function name:  cast
number of ops:  9
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > JMPZ                                                     $1, ->7
    6     5    >   ADD                                              ~2      !0, 0
          6      > RETURN                                                   ~2
   10     7    > > RETURN                                                   !0
   11     8*     > RETURN                                                   null

End of function cast

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.17 ms | 1399 KiB | 20 Q