3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "\n\n\nABC\n\nDEF\nGHI\n\n\nJKL"; preg_match_all('~\n+|.+\n?~', $str, $matches); print_r(array_map(function($i) {return strtr($i, "\n", "#");},$matches[0]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZt9Y
function name:  (null)
number of ops:  16
compiled vars:  !0 = $str, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%0A%0AABC%0A%0ADEF%0AGHI%0A%0A%0AJKL'
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%7E%5Cn%2B%7C.%2B%5Cn%3F%7E'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    7     6        INIT_FCALL                                               'print_r'
          7        INIT_FCALL                                               'array_map'
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqZt9Y%3A7%240'
          9        SEND_VAL                                                 ~4
         10        FETCH_DIM_R                                      ~5      !1, 0
         11        SEND_VAL                                                 ~5
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FqZt9Y%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qZt9Y
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%0A'
          4        SEND_VAL                                                 '%23'
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FqZt9Y%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.43 ms | 1400 KiB | 21 Q