3v4l.org

run code in 500+ PHP versions simultaneously
<?php $line = "line\rwith\nvarious\r\nline endings\n\n"; echo json_encode($line); echo PHP_EOL; echo json_encode(preg_replace('/\R/', PHP_EOL, $line));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5cBcW
function name:  (null)
number of ops:  13
compiled vars:  !0 = $line
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'line%0Dwith%0Avarious%0D%0Aline+endings%0A%0A'
    5     1        INIT_FCALL                                                   'json_encode'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        ECHO                                                         $2
    6     5        ECHO                                                         '%0A'
    7     6        INIT_FCALL                                                   'json_encode'
          7        FRAMELESS_ICALL_3                preg_replace        ~3      '%2F%5CR%2F', '%0A'
          8        OP_DATA                                                      !0
          9        SEND_VAL                                                     ~3
         10        DO_ICALL                                             $4      
         11        ECHO                                                         $4
         12      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.4 ms | 2230 KiB | 14 Q