3v4l.org

run code in 500+ PHP versions simultaneously
<?php function prepareForOutput($content, $exclude=[]) { $replacements = [ "\r" => '\r', "\n" => '\n', "\t" => '\t', " " => '·', ]; if (stripos(PHP_OS, 'WIN') === 0 && PHP_VERSION_ID < 70100) { // Do not replace spaces on old PHP on Windows. // Printing Unicode characters like '·' to Windows console only works since PHP 7.1. unset($replacements[" "]); } $replacements = array_diff_key($replacements, array_fill_keys($exclude, true)); // Colour runs of invisible characters. $match = implode('', array_keys($replacements)); $content = preg_replace("/([$match]+)/", "\033[30;1m$1\033[0m", $content); $content = strtr($content, $replacements); return $content; } for ($i = 0; $i < 10000; $i++) { prepareForOutput('{echo 1;}', ["\r"]); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
Branch analysis from position: 2
filename:       /in/7NQUU
function name:  (null)
number of ops:  10
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->7
   30     2    >   INIT_FCALL                                                   'prepareforoutput'
          3        SEND_VAL                                                     '%7Becho+1%3B%7D'
          4        SEND_VAL                                                     <array>
          5        DO_FCALL                                          0          
   29     6        PRE_INC                                                      !0
          7    >   IS_SMALLER                                                   !0, 10000
          8      > JMPNZ                                                        ~4, ->2
   31     9    > > RETURN                                                       1

Function prepareforoutput:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
Branch analysis from position: 10
filename:       /in/7NQUU
function name:  prepareForOutput
number of ops:  36
compiled vars:  !0 = $content, !1 = $exclude, !2 = $replacements, !3 = $match
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      <array>
    5     2        ASSIGN                                                       !2, <array>
   11     3        INIT_FCALL                                                   'stripos'
          4        SEND_VAL                                                     'Linux'
          5        SEND_VAL                                                     'WIN'
          6        DO_ICALL                                             $5      
          7        IS_IDENTICAL                                         ~6      $5, 0
          8      > JMPZ_EX                                              ~6      ~6, ->10
          9    >   BOOL                                                 ~6      <false>
         10    > > JMPZ                                                         ~6, ->12
   14    11    >   UNSET_DIM                                                    !2, '+'
   17    12    >   INIT_FCALL                                                   'array_diff_key'
         13        SEND_VAR                                                     !2
         14        INIT_FCALL                                                   'array_fill_keys'
         15        SEND_VAR                                                     !1
         16        SEND_VAL                                                     <true>
         17        DO_ICALL                                             $7      
         18        SEND_VAR                                                     $7
         19        DO_ICALL                                             $8      
         20        ASSIGN                                                       !2, $8
   20    21        INIT_FCALL                                                   'array_keys'
         22        SEND_VAR                                                     !2
         23        DO_ICALL                                             $10     
         24        FRAMELESS_ICALL_2                implode             ~11     '', $10
         25        ASSIGN                                                       !3, ~11
   21    26        ROPE_INIT                                         3  ~14     '%2F%28%5B'
         27        ROPE_ADD                                          1  ~14     ~14, !3
         28        ROPE_END                                          2  ~13     ~14, '%5D%2B%29%2F'
         29        FRAMELESS_ICALL_3                preg_replace        ~16     ~13, '%1B%5B30%3B1m%241%1B%5B0m'
         30        OP_DATA                                                      !0
         31        ASSIGN                                                       !0, ~16
   23    32        FRAMELESS_ICALL_2                strtr               ~18     !0, !2
         33        ASSIGN                                                       !0, ~18
   25    34      > RETURN                                                       !0
   27    35*     > RETURN                                                       null

End of function prepareforoutput

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
209.6 ms | 3329 KiB | 18 Q