3v4l.org

run code in 300+ PHP versions simultaneously
<?php $filename = '10.jpg'; $size = 'profile'; echo preg_replace('/(\.[^.]*)$/', "-$size$1", $filename); echo "\n"; $filename = 'john.smith.jpg'; $size = 'profile'; echo preg_replace('/(\.[^.]*)$/', "-$size$1", $filename);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YPsVk
function name:  (null)
number of ops:  24
compiled vars:  !0 = $filename, !1 = $size
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '10.jpg'
    4     1        ASSIGN                                                   !1, 'profile'
    5     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%28%5C.%5B%5E.%5D%2A%29%24%2F'
          4        ROPE_INIT                                     3  ~5      '-'
          5        ROPE_ADD                                      1  ~5      ~5, !1
          6        ROPE_END                                      2  ~4      ~5, '%241'
          7        SEND_VAL                                                 ~4
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10        ECHO                                                     $7
    6    11        ECHO                                                     '%0A'
    7    12        ASSIGN                                                   !0, 'john.smith.jpg'
    8    13        ASSIGN                                                   !1, 'profile'
    9    14        INIT_FCALL                                               'preg_replace'
         15        SEND_VAL                                                 '%2F%28%5C.%5B%5E.%5D%2A%29%24%2F'
         16        ROPE_INIT                                     3  ~11     '-'
         17        ROPE_ADD                                      1  ~11     ~11, !1
         18        ROPE_END                                      2  ~10     ~11, '%241'
         19        SEND_VAL                                                 ~10
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $13     
         22        ECHO                                                     $13
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.78 ms | 1405 KiB | 15 Q