3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = [1, 2, 3, 4]; $arr = []; foreach($foo as $bar) { try { if($bar == 3) { throw new Exception("error: " + $bar); } $arr[] = $bar; } catch (Exception $e) { $arr[] = $e->getMessage(); } } echo implode($arr, ',');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
filename:       /in/vVND7
function name:  (null)
number of ops:  27
compiled vars:  !0 = $foo, !1 = $arr, !2 = $bar, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $6      !0, ->20
          3    > > FE_FETCH_R                                               $6, !2, ->20
    7     4    >   IS_EQUAL                                                 !2, 3
          5      > JMPZ                                                     ~7, ->11
    8     6    >   NEW                                              $8      'Exception'
          7        ADD                                              ~9      'error%3A+', !2
          8        SEND_VAL_EX                                              ~9
          9        DO_FCALL                                      0          
         10      > THROW                                         0          $8
   10    11    >   ASSIGN_DIM                                               !1
         12        OP_DATA                                                  !2
         13      > JMP                                                      ->19
   11    14  E > > CATCH                                       last         'Exception'
   12    15    >   INIT_METHOD_CALL                                         !3, 'getMessage'
         16        DO_FCALL                                      0  $13     
         17        ASSIGN_DIM                                               !1
         18        OP_DATA                                                  $13
    5    19    > > JMP                                                      ->3
         20    >   FE_FREE                                                  $6
   15    21        INIT_FCALL                                               'implode'
         22        SEND_VAR                                                 !1
         23        SEND_VAL                                                 '%2C'
         24        DO_ICALL                                         $14     
         25        ECHO                                                     $14
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.2 ms | 1396 KiB | 15 Q