3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = <<<'STR' $array = ['bananna', 'cranberry', 'apple']; $fn = function ($a, $b) { if(strlen($a) > strlen($b)) { return 1; } return 0; }; usort($array, $fn); STR; $pattern = '%\'\w*\'%'; $replacement = 'Chocolate'; $newStory = preg_replace($pattern, $replacement, $subject); print($newStory);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bl5BR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $subject, !1 = $pattern, !2 = $replacement, !3 = $newStory
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%24array+%3D+%5B%27bananna%27%2C+%27cranberry%27%2C+%27apple%27%5D%3B%0A%24fn+%3D+function+%28%24a%2C+%24b%29+%7B%0A++++if%28strlen%28%24a%29+%3E+strlen%28%24b%29%29+%7B%0A++++++++return+1%3B%0A++++%7D%0A++++return+0%3B%0A%7D%3B%0Ausort%28%24array%2C+%24fn%29%3B'
   14     1        ASSIGN                                                   !1, '%25%27%5Cw%2A%27%25'
   15     2        ASSIGN                                                   !2, 'Chocolate'
   17     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !3, $7
   19     9        ECHO                                                     !3
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.12 ms | 939 KiB | 16 Q