3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doIt(string $line): string { $pos = strrpos($line, "&gt;"); if ($pos === false) { return $line; } if ($pos < 4 || substr($line, $pos - 4, 8) === "&gt;&gt;") { return $line; } return substr_replace($line, '<p style="color:#0f0;">', $pos, 0) . "</p>"; } function doItMultiline(string $owo): string { return implode(array_map('doIt', explode(PHP_EOL, $owo)), PHP_EOL); } $line = "awoo&gt;&gt;owo &gt;blyat lolis"; $line2 = "awoo&gt;&gt;owo"; var_dump(doItMultiline($line)); var_dump(doItMultiline($line2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3b7gi
function name:  (null)
number of ops:  15
compiled vars:  !0 = $line, !1 = $line2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'awoo%26gt%3B%26gt%3Bowo+%26gt%3Bblyat%0Alolis'
   16     1        ASSIGN                                                   !1, 'awoo%26gt%3B%26gt%3Bowo'
   18     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'doitmultiline'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   19     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'doitmultiline'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function doit:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/3b7gi
function name:  doIt
number of ops:  34
compiled vars:  !0 = $line, !1 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'strrpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%26gt%3B'
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !1, $2
    5     6        TYPE_CHECK                                    4          !1
          7      > JMPZ                                                     ~4, ->10
          8    >   VERIFY_RETURN_TYPE                                       !0
          9      > RETURN                                                   !0
    6    10    >   IS_SMALLER                                       ~5      !1, 4
         11      > JMPNZ_EX                                         ~5      ~5, ->20
         12    >   INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !0
         14        SUB                                              ~6      !1, 4
         15        SEND_VAL                                                 ~6
         16        SEND_VAL                                                 8
         17        DO_ICALL                                         $7      
         18        IS_IDENTICAL                                     ~8      $7, '%26gt%3B%26gt%3B'
         19        BOOL                                             ~5      ~8
         20    > > JMPZ                                                     ~5, ->23
         21    >   VERIFY_RETURN_TYPE                                       !0
         22      > RETURN                                                   !0
    7    23    >   INIT_FCALL                                               'substr_replace'
         24        SEND_VAR                                                 !0
         25        SEND_VAL                                                 '%3Cp+style%3D%22color%3A%230f0%3B%22%3E'
         26        SEND_VAR                                                 !1
         27        SEND_VAL                                                 0
         28        DO_ICALL                                         $9      
         29        CONCAT                                           ~10     $9, '%3C%2Fp%3E'
         30        VERIFY_RETURN_TYPE                                       ~10
         31      > RETURN                                                   ~10
    8    32*       VERIFY_RETURN_TYPE                                       
         33*     > RETURN                                                   null

End of function doit

Function doitmultiline:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3b7gi
function name:  doItMultiline
number of ops:  17
compiled vars:  !0 = $owo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'implode'
          2        INIT_FCALL                                               'array_map'
          3        SEND_VAL                                                 'doIt'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%0A'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $1      
          8        SEND_VAR                                                 $1
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
         11        SEND_VAL                                                 '%0A'
         12        DO_ICALL                                         $3      
         13        VERIFY_RETURN_TYPE                                       $3
         14      > RETURN                                                   $3
   12    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of function doitmultiline

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.82 ms | 1473 KiB | 22 Q