fork(1) download
  1. <?php
  2.  
  3. $str = '1|2\\|2|3\\\\|4\\\\\\|4';
  4. echo $str . PHP_EOL;
  5. $r = preg_split('~\\\\.(*SKIP)(*FAIL)|\\|~s', $str);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
1|2\|2|3\\|4\\\|4
array(4) {
  [0]=>
  string(1) "1"
  [1]=>
  string(4) "2\|2"
  [2]=>
  string(3) "3\\"
  [3]=>
  string(6) "4\\\|4"
}