3v4l.org

run code in 500+ PHP versions simultaneously
<?php $tests = [ " \ntest1 \n \t \ntest1\n\n " => "test1\ntest1", " \r\ntest2 \r\n \t \r\ntest2\r\n\r\n " => "test2\r\ntest2", " \u{0085}test3 \u{0085} \t \u{0085}test3\u{0085}\u{0085} " => "test3\u{0085}test3", " \u{2029}test4 \u{2029} \t \u{2029}test4\u{2029}\u{2029} " => "test4\u{2029}test4", " \ftest5 \f \t \ftest5\f\f " => "test5\ftest5", " \rtest6 \r \t \r\rtest6\r\r " => "test6\rtest6", ]; $i = 0; $pattern = '~(*ANY)\A\s*\R|\s*(?!\r\n)\s$~mu'; foreach($tests as $input => $output) { echo 'Test', ++$i, ': ', (preg_replace($pattern, '', $input) === $output ? 'SUCCESS':'FAIL'), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/f0cB4
function name:  (null)
number of ops:  22
compiled vars:  !0 = $tests, !1 = $i, !2 = $pattern, !3 = $output, !4 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   11     1        ASSIGN                                                       !1, 0
   13     2        ASSIGN                                                       !2, '%7E%28%2AANY%29%5CA%5Cs%2A%5CR%7C%5Cs%2A%28%3F%21%5Cr%5Cn%29%5Cs%24%7Emu'
   15     3      > FE_RESET_R                                           $8      !0, ->20
          4    > > FE_FETCH_R                                           ~9      $8, !3, ->20
          5    >   ASSIGN                                                       !4, ~9
   16     6        ECHO                                                         'Test'
          7        PRE_INC                                              ~11     !1
          8        ECHO                                                         ~11
          9        ECHO                                                         '%3A+'
         10        FRAMELESS_ICALL_3                preg_replace        ~12     !2, ''
         11        OP_DATA                                                      !4
         12        IS_IDENTICAL                                                 !3, ~12
         13      > JMPZ                                                         ~13, ->16
         14    >   QM_ASSIGN                                            ~14     'SUCCESS'
         15      > JMP                                                          ->17
         16    >   QM_ASSIGN                                            ~14     'FAIL'
         17    >   ECHO                                                         ~14
         18        ECHO                                                         '%0A'
   15    19      > JMP                                                          ->4
         20    >   FE_FREE                                                      $8
   17    21      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.99 ms | 1719 KiB | 13 Q