3v4l.org

run code in 300+ PHP versions simultaneously
<?php $demostring = ' <p> Quis vel accusantium libero. Suscipit officiis culpa <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"> libero quia ad. </p> '; function ctf0_truncate($vinput){ return( preg_replace('/(data:image.{50})(.*)/', '$1', $vinput) ); } function ctf0_parse($text, $chars = 50) { if (strpos($text, 'data:image') !== FALSE){ $tokens = explode('"',$text); $tokens = array_map("ctf0_truncate",$tokens); $vout = implode('"',$tokens); } elseif( True ) { $vout = $text; } return $vout; } $myresult = ctf0_parse($demostring); echo $myresult;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cvifQ
function name:  (null)
number of ops:  7
compiled vars:  !0 = $demostring, !1 = $myresult
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%3Cp%3E%0AQuis+vel+accusantium+libero.+Suscipit+officiis+culpa%0A%3Cimg+src%3D%22data%3Aimage%2Fgif%3Bbase64%2CR0lGODlhAQABAIAAAAAAAP%2F%2F%2FyH5BAEAAAAALAAAAAABAAEAAAIBRAA7%22%3E%0Alibero+quia+ad.%0A%3C%2Fp%3E%0A'
   26     1        INIT_FCALL                                               'ctf0_parse'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   27     5        ECHO                                                     !1
          6      > RETURN                                                   1

Function ctf0_truncate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cvifQ
function name:  ctf0_truncate
number of ops:  8
compiled vars:  !0 = $vinput
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%28data%3Aimage.%7B50%7D%29%28.%2A%29%2F'
          3        SEND_VAL                                                 '%241'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   13     7*     > RETURN                                                   null

End of function ctf0_truncate

Function ctf0_parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/cvifQ
function name:  ctf0_parse
number of ops:  28
compiled vars:  !0 = $text, !1 = $chars, !2 = $tokens, !3 = $vout
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      50
   16     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'data%3Aimage'
          5        DO_ICALL                                         $4      
          6        TYPE_CHECK                                  1018          $4
          7      > JMPZ                                                     ~5, ->24
   17     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%22'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !2, $6
   18    13        INIT_FCALL                                               'array_map'
         14        SEND_VAL                                                 'ctf0_truncate'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $8      
         17        ASSIGN                                                   !2, $8
   19    18        INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 '%22'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $10     
         22        ASSIGN                                                   !3, $10
   16    23      > JMP                                                      ->26
   20    24    > > JMPZ                                                     <true>, ->26
   21    25    >   ASSIGN                                                   !3, !0
   23    26    > > RETURN                                                   !3
   24    27*     > RETURN                                                   null

End of function ctf0_parse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.73 ms | 1017 KiB | 19 Q