3v4l.org

run code in 500+ PHP versions simultaneously
<?php $haystack = [ [ 'messages' => [ ['message' => 'This is for sandwich'], ['message' => 'This message is for burger'], ], 'price' => ['amount' => 5, 'currency' => 'USD'] ], [ 'messages' => [ ['message' => 'This is a message for a delicious hotdog'] ], 'price' => ['amount' => 3, 'currency' => 'USD'] ] ]; $needle = 'burger'; $amount = null; foreach ($haystack as ['messages' => $messages, 'price' => $price]) { foreach ($messages as $message) { if (str_contains($message['message'], $needle)) { $amount = $price['amount']; break; } } } var_export($amount);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
Branch analysis from position: 19
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/Sr4rm
function name:  (null)
number of ops:  26
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $amount, !3 = $messages, !4 = $price, !5 = $message
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   18     1        ASSIGN                                                       !1, 'burger'
   20     2        ASSIGN                                                       !2, null
   21     3      > FE_RESET_R                                           $9      !0, ->21
          4    > > FE_FETCH_R                                                   $9, $10, ->21
          5    >   FETCH_LIST_R                                         $11     $10, 'messages'
          6        ASSIGN                                                       !3, $11
          7        FETCH_LIST_R                                         $13     $10, 'price'
          8        ASSIGN                                                       !4, $13
          9        FREE                                                         $10
   22    10      > FE_RESET_R                                           $15     !3, ->19
         11    > > FE_FETCH_R                                                   $15, !5, ->19
   23    12    >   FETCH_DIM_R                                          ~16     !5, 'message'
         13        FRAMELESS_ICALL_2                str_contains        ~17     ~16, !1
         14      > JMPZ                                                         ~17, ->18
   24    15    >   FETCH_DIM_R                                          ~18     !4, 'amount'
         16        ASSIGN                                                       !2, ~18
   25    17      > JMP                                                          ->19
   22    18    > > JMP                                                          ->11
         19    >   FE_FREE                                                      $15
   21    20      > JMP                                                          ->4
         21    >   FE_FREE                                                      $9
   29    22        INIT_FCALL                                                   'var_export'
         23        SEND_VAR                                                     !2
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.31 ms | 1856 KiB | 14 Q