3v4l.org

run code in 300+ PHP versions simultaneously
<?php function makeKeyboard($str) { $kb = array(); $kb_row = explode('|', $str); foreach($kb_row as $row) { $buttons = explode(',', $row); $newrow = array(); foreach($buttons as $text) { $newrow[] = array('text' => $text); } $kb[] = $newrow; } return $kb; } $test = "button1.1|button2.1,button2.2,button2.3|button3.1|button4.1,button4.2"; $keyboard = makeKeyboard($test); print_r($keyboard); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sXqWI
function name:  (null)
number of ops:  9
compiled vars:  !0 = $test, !1 = $keyboard
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, 'button1.1%7Cbutton2.1%2Cbutton2.2%2Cbutton2.3%7Cbutton3.1%7Cbutton4.1%2Cbutton4.2'
   19     1        INIT_FCALL                                               'makekeyboard'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   21     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
   23     8      > RETURN                                                   1

Function makekeyboard:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 25
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 25
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 21
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/sXqWI
function name:  makeKeyboard
number of ops:  28
compiled vars:  !0 = $str, !1 = $kb, !2 = $kb_row, !3 = $row, !4 = $buttons, !5 = $newrow, !6 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%7C'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
    7     7      > FE_RESET_R                                       $10     !2, ->25
          8    > > FE_FETCH_R                                               $10, !3, ->25
    8     9    >   INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '%2C'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $11     
         13        ASSIGN                                                   !4, $11
    9    14        ASSIGN                                                   !5, <array>
   10    15      > FE_RESET_R                                       $14     !4, ->21
         16    > > FE_FETCH_R                                               $14, !6, ->21
   11    17    >   INIT_ARRAY                                       ~16     !6, 'text'
         18        ASSIGN_DIM                                               !5
         19        OP_DATA                                                  ~16
   10    20      > JMP                                                      ->16
         21    >   FE_FREE                                                  $14
   13    22        ASSIGN_DIM                                               !1
         23        OP_DATA                                                  !5
    7    24      > JMP                                                      ->8
         25    >   FE_FREE                                                  $10
   15    26      > RETURN                                                   !1
   16    27*     > RETURN                                                   null

End of function makekeyboard

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
272.22 ms | 1019 KiB | 16 Q