3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<TEXT This is just some text, with something in the middle that has newlines around it. TEXT; $result = strpos($text, "\nsomething in the middle"); echo 'This works: '; var_dump($result); echo "\n<br>\n"; $buggy_result = strpos($text, "something in the middle\r"); echo 'This does not: '; var_dump($buggy_result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Z7aRd
function name:  (null)
number of ops:  21
compiled vars:  !0 = $text, !1 = $result, !2 = $buggy_result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+is+just+some+text%2C+with+%0A%0Asomething+in+the+middle%0A%0Athat+has+newlines+around+it.'
   13     1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%0Asomething+in+the+middle'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   14     6        ECHO                                                     'This+works%3A+'
          7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
   16    10        ECHO                                                     '%0A%3Cbr%3E%0A'
   18    11        INIT_FCALL                                               'strpos'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'something+in+the+middle%0D'
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !2, $7
   19    16        ECHO                                                     'This+does+not%3A+'
         17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !2
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.48 ms | 1395 KiB | 17 Q