3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = "An elephant is an elephant"; print str_replace('ph', 'php', $string); print PHP_EOL; print preg_replace('/ph/', 'php', $string); print PHP_EOL; print preg_replace('/ph/', 'php', $string, limit: 1); print PHP_EOL; $d = explode('ph', $string, 2); print implode('php', $d);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qIoDi
function name:  (null)
number of ops:  26
compiled vars:  !0 = $string, !1 = $d
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'An+elephant+is+an+elephant'
    5     1        FRAMELESS_ICALL_3                str_replace         ~3      'ph', 'php'
          2        OP_DATA                                                      !0
          3        ECHO                                                         ~3
    6     4        ECHO                                                         '%0A'
    7     5        FRAMELESS_ICALL_3                preg_replace        ~4      '%2Fph%2F', 'php'
          6        OP_DATA                                                      !0
          7        ECHO                                                         ~4
    8     8        ECHO                                                         '%0A'
    9     9        INIT_FCALL                                                   'preg_replace'
         10        SEND_VAL                                                     '%2Fph%2F'
         11        SEND_VAL                                                     'php'
         12        SEND_VAR                                                     !0
         13        SEND_VAL                                                     1
         14        DO_ICALL                                             $5      
         15        ECHO                                                         $5
   10    16        ECHO                                                         '%0A'
   11    17        INIT_FCALL                                                   'explode'
         18        SEND_VAL                                                     'ph'
         19        SEND_VAR                                                     !0
         20        SEND_VAL                                                     2
         21        DO_ICALL                                             $6      
         22        ASSIGN                                                       !1, $6
   12    23        FRAMELESS_ICALL_2                implode             ~8      'php', !1
         24        ECHO                                                         ~8
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
128.32 ms | 480 KiB | 9 Q