3v4l.org

run code in 300+ 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:  22
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        INIT_FCALL                                               'str_replace'
          7        SEND_VAR                                                 !1
          8        INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 1
         11        SEND_VAL                                                 -1
         12        DO_ICALL                                         $5      
         13        CONCAT                                           ~6      '+and', $5
         14        SEND_VAL                                                 ~6
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $7      
         17        ASSIGN                                                   !0, $7
    7    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.14 ms | 1399 KiB | 21 Q