3v4l.org

run code in 500+ PHP versions simultaneously
<?php $customers='[ { "id": 1, "name": "sara", "phone": 1100, "mobile": 1111 }, { "id": 2, "name": "ben", "phone": 2200, "mobile": 2222 } ]'; foreach(json_decode($customers, true) as $a){ if($a['name'] == 'sara'){ $phone = $a['phone']; $mobile = $a['mobile']; echo "sara's phone is $phone"; echo "sara's mobile is $mobile"; } else{ echo "No customer found with this name"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/ciMLm
function name:  (null)
number of ops:  25
compiled vars:  !0 = $customers, !1 = $a, !2 = $phone, !3 = $mobile
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%5B%0A+%7B%0A++%22id%22%3A+1%2C%0A++%22name%22%3A+%22sara%22%2C%0A++%22phone%22%3A+1100%2C%0A++%22mobile%22%3A+1111%0A+%7D%2C%0A+%7B%0A++%22id%22%3A+2%2C%0A++%22name%22%3A+%22ben%22%2C%0A++%22phone%22%3A+2200%2C%0A++%22mobile%22%3A+2222%0A+%7D%0A%5D'
   18     1        INIT_FCALL                                                   'json_decode'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     <true>
          4        DO_ICALL                                             $5      
          5      > FE_RESET_R                                           $6      $5, ->23
          6    > > FE_FETCH_R                                                   $6, !1, ->23
   19     7    >   FETCH_DIM_R                                          ~7      !1, 'name'
          8        IS_EQUAL                                                     ~7, 'sara'
          9      > JMPZ                                                         ~8, ->21
   20    10    >   FETCH_DIM_R                                          ~9      !1, 'phone'
         11        ASSIGN                                                       !2, ~9
   21    12        FETCH_DIM_R                                          ~11     !1, 'mobile'
         13        ASSIGN                                                       !3, ~11
   22    14        NOP                                                          
         15        FAST_CONCAT                                          ~13     'sara%27s+phone+is+', !2
         16        ECHO                                                         ~13
   23    17        NOP                                                          
         18        FAST_CONCAT                                          ~14     'sara%27s+mobile+is+', !3
         19        ECHO                                                         ~14
   19    20      > JMP                                                          ->22
   26    21    >   ECHO                                                         'No+customer+found+with+this+name'
   18    22    > > JMP                                                          ->6
         23    >   FE_FREE                                                      $6
   28    24      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
200.03 ms | 1721 KiB | 14 Q