3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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\n"); 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/tvjlY
function name:  (null)
number of ops:  20
compiled vars:  !0 = $result, !1 = $text, !2 = $buggy_result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'strpos'
          1        SEND_VAR                                                 !1
          2        SEND_VAL                                                 '%0Asomething+in+the+middle'
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    4     5        ECHO                                                     'This+works%3A+'
          6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
    6     9        ECHO                                                     '%0A%3Cbr%3E%0A'
    8    10        INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 'something+in+the+middle%0A'
         13        DO_ICALL                                         $6      
         14        ASSIGN                                                   !2, $6
    9    15        ECHO                                                     'This+does+not%3A+'
         16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.29 ms | 1395 KiB | 17 Q