3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = " 12| 150 | test one| 33235 13| 151| test two |33236 "; $pattern = '/(?:\s\|\s)|(?:\s\|)|(?:\|\s)/'; echo preg_replace($pattern, '|', $string);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IDnpa
function name:  (null)
number of ops:  9
compiled vars:  !0 = $string, !1 = $pattern
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A12%7C+150+%7C+test+one%7C+33235%0A13%7C+151%7C+test+two+%7C33236%0A'
    7     1        ASSIGN                                                   !1, '%2F%28%3F%3A%5Cs%5C%7C%5Cs%29%7C%28%3F%3A%5Cs%5C%7C%29%7C%28%3F%3A%5C%7C%5Cs%29%2F'
    9     2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 '%7C'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ECHO                                                     $4
          8      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.91 ms | 1394 KiB | 15 Q