3v4l.org

run code in 300+ PHP versions simultaneously
<?php const COMMA = ','; const EMPTY_STR = ''; $d = '\n'; echo ("\x0a" == "\n")? 'yes' : 'no',"\n"; $data = "1,2,3,$d,4,5,6,$d,7,8,9"; echo "data: $data\n"; $replace = array(COMMA,$d); $subjects = array(EMPTY_STR,"\x0a"); $str = str_replace( $replace, $subjects, $data); echo "Output:\n\n$str",PHP_EOL; // echo doesn't emit \n
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5gi6Y
function name:  (null)
number of ops:  38
compiled vars:  !0 = $d, !1 = $data, !2 = $replace, !3 = $subjects, !4 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CONST                                            'COMMA', '%2C'
    4     1        DECLARE_CONST                                            'EMPTY_STR', ''
    6     2        ASSIGN                                                   !0, '%5Cn'
    7     3      > JMPZ                                                     <true>, ->6
          4    >   QM_ASSIGN                                        ~6      'yes'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~6      'no'
          7    >   ECHO                                                     ~6
          8        ECHO                                                     '%0A'
    9     9        ROPE_INIT                                     5  ~8      '1%2C2%2C3%2C'
         10        ROPE_ADD                                      1  ~8      ~8, !0
         11        ROPE_ADD                                      2  ~8      ~8, '%2C4%2C5%2C6%2C'
         12        ROPE_ADD                                      3  ~8      ~8, !0
         13        ROPE_END                                      4  ~7      ~8, '%2C7%2C8%2C9'
         14        ASSIGN                                                   !1, ~7
   11    15        ROPE_INIT                                     3  ~13     'data%3A+'
         16        ROPE_ADD                                      1  ~13     ~13, !1
         17        ROPE_END                                      2  ~12     ~13, '%0A'
         18        ECHO                                                     ~12
   13    19        FETCH_CONSTANT                                   ~15     'COMMA'
         20        INIT_ARRAY                                       ~16     ~15
         21        ADD_ARRAY_ELEMENT                                ~16     !0
         22        ASSIGN                                                   !2, ~16
   14    23        FETCH_CONSTANT                                   ~18     'EMPTY_STR'
         24        INIT_ARRAY                                       ~19     ~18
         25        ADD_ARRAY_ELEMENT                                ~19     '%0A'
         26        ASSIGN                                                   !3, ~19
   15    27        INIT_FCALL                                               'str_replace'
         28        SEND_VAR                                                 !2
         29        SEND_VAR                                                 !3
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                         $21     
         32        ASSIGN                                                   !4, $21
   17    33        NOP                                                      
         34        FAST_CONCAT                                      ~23     'Output%3A%0A%0A', !4
         35        ECHO                                                     ~23
         36        ECHO                                                     '%0A'
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.47 ms | 1396 KiB | 15 Q