3v4l.org

run code in 300+ PHP versions simultaneously
$str = "required|equals[1|2|3|4|5]|trim"; preg_match_all('/[^\[\|]+(?:\[.+?\])?/', $str, $matches); print_r($matches[0]);<?php
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pN2lZ
function name:  (null)
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%24str+%3D+%22required%7Cequals%5B1%7C2%7C3%7C4%7C5%5D%7Ctrim%22%3B%0A%0Apreg_match_all%28%27%2F%5B%5E%5C%5B%5C%7C%5D%2B%28%3F%3A%5C%5B.%2B%3F%5C%5D%29%3F%2F%27%2C+%24str%2C+%24matches%29%3B%0A%0Aprint_r%28%24matches%5B0%5D%29%3B'
    5     1      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.6 ms | 1392 KiB | 13 Q