3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = "this is school of sachin". $pattern = "sch"; $words = explode(" ", $a); foreach($words as $word){ $pos = strpos(strrev($word), strrev($pattern)); if($pos !== false){ print(strlen($word)-$pos); break; } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 28
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 28
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 27
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 28
Branch analysis from position: 28
filename:       /in/Q4j91
function name:  (null)
number of ops:  30
compiled vars:  !0 = $a, !1 = $pattern, !2 = $words, !3 = $word, !4 = $pos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                           ~5      !1, 'sch'
          1        CONCAT                                           ~6      'this+is+school+of+sachin', ~5
    2     2        ASSIGN                                                   !0, ~6
    4     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '+'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !2, $8
    5     8      > FE_RESET_R                                       $10     !2, ->28
          9    > > FE_FETCH_R                                               $10, !3, ->28
    6    10    >   INIT_FCALL                                               'strpos'
         11        INIT_FCALL                                               'strrev'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                         $11     
         14        SEND_VAR                                                 $11
         15        INIT_FCALL                                               'strrev'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $12     
         18        SEND_VAR                                                 $12
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !4, $13
    7    21        TYPE_CHECK                                  1018          !4
         22      > JMPZ                                                     ~15, ->27
    8    23    >   STRLEN                                           ~16     !3
         24        SUB                                              ~17     ~16, !4
         25        ECHO                                                     ~17
    9    26      > JMP                                                      ->28
    5    27    > > JMP                                                      ->9
         28    >   FE_FREE                                                  $10
   12    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
206.88 ms | 1401 KiB | 19 Q