3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static function cast(&$val, $key) { if (is_numeric($val)&& $val[0] != '0') { $val += 0; } } static function run() { $arr = ['stri33ng123', 84, 76.7, '45.6', '67.5e45', '56,9', '078']; var_dump($arr); //array_walk($arr , ['self', 'cast']); array_walk($arr , 'self::cast'); var_dump($arr); } } A::run(); //&& $val[0] != '0') {
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jd3dp
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_STATIC_METHOD_CALL                                  'A', 'run'
          1        DO_FCALL                                      0          
   30     2      > RETURN                                                   1

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

End of function cast

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jd3dp
function name:  run
number of ops:  12
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   16     4        INIT_FCALL                                               'array_walk'
          5        SEND_REF                                                 !0
          6        SEND_VAL                                                 'self%3A%3Acast'
          7        DO_ICALL                                                 
   17     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
   18    11      > RETURN                                                   null

End of function run

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.64 ms | 1396 KiB | 19 Q