3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = <<<'EOF' 1;PHP;Likes dollar signs 2;Python;Likes whitespace 3;Ruby;Likes blocks EOF; function input_parser($input) { foreach (explode("\n", $input) as $line) { $fields = explode(';', $line); $id = array_shift($fields); yield $id => $fields; } } foreach (input_parser($input) as $id => $fields) { echo "$id:\n"; echo " $fields[0]\n"; echo " $fields[1]\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/4ad2J
function name:  (null)
number of ops:  23
compiled vars:  !0 = $input, !1 = $fields, !2 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '1%3BPHP%3BLikes+dollar+signs%0A2%3BPython%3BLikes+whitespace%0A3%3BRuby%3BLikes+blocks'
   17     1        INIT_FCALL                                               'input_parser'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $4      
          4      > FE_RESET_R                                       $5      $4, ->21
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->21
          6    >   ASSIGN                                                   !2, ~6
   18     7        NOP                                                      
          8        FAST_CONCAT                                      ~8      !2, '%3A%0A'
          9        ECHO                                                     ~8
   19    10        ROPE_INIT                                     3  ~11     '++++'
         11        FETCH_DIM_R                                      ~9      !1, 0
         12        ROPE_ADD                                      1  ~11     ~11, ~9
         13        ROPE_END                                      2  ~10     ~11, '%0A'
         14        ECHO                                                     ~10
   20    15        ROPE_INIT                                     3  ~15     '++++'
         16        FETCH_DIM_R                                      ~13     !1, 1
         17        ROPE_ADD                                      1  ~15     ~15, ~13
         18        ROPE_END                                      2  ~14     ~15, '%0A'
         19        ECHO                                                     ~14
   17    20      > JMP                                                      ->5
         21    >   FE_FREE                                                  $5
   21    22      > RETURN                                                   1

Function input_parser:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 19
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 19
filename:       /in/4ad2J
function name:  input_parser
number of ops:  21
compiled vars:  !0 = $input, !1 = $line, !2 = $fields, !3 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    9     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6      > FE_RESET_R                                       $5      $4, ->19
          7    > > FE_FETCH_R                                               $5, !1, ->19
   10     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%3B'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !2, $6
   11    13        INIT_FCALL                                               'array_shift'
         14        SEND_REF                                                 !2
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !3, $8
   13    17        YIELD                                                    !2, !3
    9    18      > JMP                                                      ->7
         19    >   FE_FREE                                                  $5
   15    20      > GENERATOR_RETURN                                         

End of function input_parser

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.54 ms | 1403 KiB | 18 Q