3v4l.org

run code in 500+ PHP versions simultaneously
<?php $likes = 'Apple, Samsung, Microsoft'; $portion = strrchr($likes, ','); $likes = str_replace($portion, (" and" . substr($portion, 1, -1)), $likes); var_dump($likes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JSC7E
function name:  (null)
number of ops:  16
compiled vars:  !0 = $likes, !1 = $portion
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'Apple%2C+Samsung%2C+Microsoft'
    4     1        INIT_FCALL                                                   'strrchr'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     '%2C'
          4        DO_ICALL                                             $3      
          5        ASSIGN                                                       !1, $3
    5     6        FRAMELESS_ICALL_3                substr              ~5      !1, 1
          7        OP_DATA                                                      -1
          8        CONCAT                                               ~6      '+and', ~5
          9        FRAMELESS_ICALL_3                str_replace         ~7      !1, ~6
         10        OP_DATA                                                      !0
         11        ASSIGN                                                       !0, ~7
    7    12        INIT_FCALL                                                   'var_dump'
         13        SEND_VAR                                                     !0
         14        DO_ICALL                                                     
         15      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.91 ms | 2431 KiB | 15 Q