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']; foreach($arr as $a) { var_dump(cast($a)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 10
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/cOGfa
function name:  (null)
number of ops:  12
compiled vars:  !0 = $arr, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   15     1      > FE_RESET_R                                       $3      !0, ->10
          2    > > FE_FETCH_R                                               $3, !1, ->10
   16     3    >   INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'cast'
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   15     9      > JMP                                                      ->2
         10    >   FE_FREE                                                  $3
   18    11      > 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/cOGfa
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:
153.68 ms | 1398 KiB | 18 Q