3v4l.org

run code in 300+ PHP versions simultaneously
<?php $insert = ""; $array1 = array( '1' => array( 'prodid' => 1, 'title' => 'product one', 'amount' => 10 ), '2' => array( 'prodid' => 2, 'title' => 'product two', 'amount' => 10 ), '3' => array( 'prodid' => 3, 'title' => 'product three', 'amount' => 10 ) ); foreach ($array1 as $prodid => $data){ $insert .= "($prodid,'".$data['title']."',{$data['amount']}),"; } $insert = substr($insert,0,-1); echo $insert;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/7RDU7
function name:  (null)
number of ops:  26
compiled vars:  !0 = $insert, !1 = $array1, !2 = $data, !3 = $prodid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, ''
    4     1        ASSIGN                                                   !1, <array>
   22     2      > FE_RESET_R                                       $6      !1, ->17
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->17
          4    >   ASSIGN                                                   !3, ~7
   24     5        ROPE_INIT                                     3  ~10     '%28'
          6        ROPE_ADD                                      1  ~10     ~10, !3
          7        ROPE_END                                      2  ~9      ~10, '%2C%27'
          8        FETCH_DIM_R                                      ~12     !2, 'title'
          9        CONCAT                                           ~13     ~9, ~12
         10        ROPE_INIT                                     3  ~16     '%27%2C'
         11        FETCH_DIM_R                                      ~14     !2, 'amount'
         12        ROPE_ADD                                      1  ~16     ~16, ~14
         13        ROPE_END                                      2  ~15     ~16, '%29%2C'
         14        CONCAT                                           ~18     ~13, ~15
         15        ASSIGN_OP                                     8          !0, ~18
   22    16      > JMP                                                      ->3
         17    >   FE_FREE                                                  $6
   28    18        INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 -1
         22        DO_ICALL                                         $20     
         23        ASSIGN                                                   !0, $20
   30    24        ECHO                                                     !0
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.7 ms | 1395 KiB | 15 Q