3v4l.org

run code in 500+ PHP versions simultaneously
<?php $input = "hello:20,test:40,abc:25"; function transform_input($input) { return array_map(function ($value) { list($title, $length) = explode(':', $value); return [ 'title' => $title, 'length' => $length ]; }, explode(',', $input)); } $array = transform_input($input); for($i=0; $i < count($array); $i++) { ?> <th><?=$array[$i]["length"]?></th> <th><?=$array[$i]["title"]?></th> <?php } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 7
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 7
Branch analysis from position: 20
Branch analysis from position: 7
filename:       /in/FnFpg
function name:  (null)
number of ops:  21
compiled vars:  !0 = $input, !1 = $array, !2 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'hello%3A20%2Ctest%3A40%2Cabc%3A25'
   16     1        INIT_FCALL                                                   'transform_input'
          2        SEND_VAR                                                     !0
          3        DO_FCALL                                          0  $4      
          4        ASSIGN                                                       !1, $4
   18     5        ASSIGN                                                       !2, 0
          6      > JMP                                                          ->17
   19     7    >   ECHO                                                         '+++%3Cth%3E'
          8        FETCH_DIM_R                                          ~7      !1, !2
          9        FETCH_DIM_R                                          ~8      ~7, 'length'
         10        ECHO                                                         ~8
         11        ECHO                                                         '%3C%2Fth%3E%0A+++%3Cth%3E'
   20    12        FETCH_DIM_R                                          ~9      !1, !2
         13        FETCH_DIM_R                                          ~10     ~9, 'title'
         14        ECHO                                                         ~10
         15        ECHO                                                         '%3C%2Fth%3E%0A'
   18    16        PRE_INC                                                      !2
         17    >   COUNT                                                ~12     !1
         18        IS_SMALLER                                                   !2, ~12
         19      > JMPNZ                                                        ~13, ->7
   21    20    > > RETURN                                                       1

Function transform_input:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FnFpg
function name:  transform_input
number of ops:  12
compiled vars:  !0 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
    6     1        INIT_FCALL                                                   'array_map'
          2        DECLARE_LAMBDA_FUNCTION                              ~1      [0]
   13     3        SEND_VAL                                                     ~1
          4        INIT_FCALL                                                   'explode'
          5        SEND_VAL                                                     '%2C'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                             $2      
          8        SEND_VAR                                                     $2
    6     9        DO_ICALL                                             $3      
   13    10      > RETURN                                                       $3
   14    11*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FnFpg
function name:  {closure:transform_input():6}
number of ops:  14
compiled vars:  !0 = $value, !1 = $title, !2 = $length
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '%3A'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $3      
          5        FETCH_LIST_R                                         $4      $3, 0
          6        ASSIGN                                                       !1, $4
          7        FETCH_LIST_R                                         $6      $3, 1
          8        ASSIGN                                                       !2, $6
          9        FREE                                                         $3
   10    10        INIT_ARRAY                                           ~8      !1, 'title'
   11    11        ADD_ARRAY_ELEMENT                                    ~8      !2, 'length'
         12      > RETURN                                                       ~8
   13    13*     > RETURN                                                       null

End of Dynamic Function 0

End of function transform_input

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
225.04 ms | 2050 KiB | 16 Q