3v4l.org

run code in 300+ 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 = 23
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 23
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/f0cB4
function name:  (null)
number of ops:  25
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, ->23
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->23
          5    >   ASSIGN                                                   !4, ~9
   16     6        ECHO                                                     'Test'
          7        PRE_INC                                          ~11     !1
          8        ECHO                                                     ~11
          9        ECHO                                                     '%3A+'
         10        INIT_FCALL                                               'preg_replace'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 ''
         13        SEND_VAR                                                 !4
         14        DO_ICALL                                         $12     
         15        IS_IDENTICAL                                             !3, $12
         16      > JMPZ                                                     ~13, ->19
         17    >   QM_ASSIGN                                        ~14     'SUCCESS'
         18      > JMP                                                      ->20
         19    >   QM_ASSIGN                                        ~14     'FAIL'
         20    >   ECHO                                                     ~14
         21        ECHO                                                     '%0A'
   15    22      > JMP                                                      ->4
         23    >   FE_FREE                                                  $8
   17    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.8 ms | 1011 KiB | 14 Q