3v4l.org

run code in 300+ PHP versions simultaneously
<?php $notes = array( '-Rnote', '-Gnote', '-Ynote', 'note1 -R', '-Gnote1', '-Ynote1', ); $colors = array( '-R' => 'red', '-G' => 'green', '-Y' => 'yellow', ); foreach ($notes as $note ) { If(isset($colors[substr($note,0,2)])){ echo str_replace(substr($note, 0, 2), '<span style="background-color:' . $colors[substr($note, 0, 2)] . '">', $note) . "</span>\n"; }Else{ Echo $note ."\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 35
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 35
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 32
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/9YDAX
function name:  (null)
number of ops:  37
compiled vars:  !0 = $notes, !1 = $colors, !2 = $note
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   18     2      > FE_RESET_R                                       $5      !0, ->35
          3    > > FE_FETCH_R                                               $5, !2, ->35
   19     4    >   INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !2
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $6      
          9        ISSET_ISEMPTY_DIM_OBJ                         0          !1, $6
         10      > JMPZ                                                     ~7, ->32
   20    11    >   INIT_FCALL                                               'str_replace'
         12        INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 0
         15        SEND_VAL                                                 2
         16        DO_ICALL                                         $8      
         17        SEND_VAR                                                 $8
         18        INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !2
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $9      
         23        FETCH_DIM_R                                      ~10     !1, $9
         24        CONCAT                                           ~11     '%3Cspan+style%3D%22background-color%3A', ~10
         25        CONCAT                                           ~12     ~11, '%22%3E'
         26        SEND_VAL                                                 ~12
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $13     
         29        CONCAT                                           ~14     $13, '%3C%2Fspan%3E%0A'
         30        ECHO                                                     ~14
   19    31      > JMP                                                      ->34
   22    32    >   CONCAT                                           ~15     !2, '%0A'
         33        ECHO                                                     ~15
   18    34    > > JMP                                                      ->3
         35    >   FE_FREE                                                  $5
   24    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.72 ms | 1007 KiB | 15 Q