3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'yes or yes no or yes yes or no maybe yes or yes maybe yes or no yes maybe or yes maybe yes maybe yes maybe or'; $array = explode("\n", $string); $expected = []; //print_r($array); foreach($array as $line){ $words = substr_count($line,'yes'); if($words==2 && strpos($line, 'or') !== false ){ $expected[]= $line; } } echo implode("\n",$expected);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 23
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 22
Branch analysis from position: 19
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/uL7fJ
function name:  (null)
number of ops:  27
compiled vars:  !0 = $string, !1 = $array, !2 = $expected, !3 = $line, !4 = $words
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, 'yes+or+yes%0Ano+or+yes%0Ayes+or+no%0Amaybe+yes+or+yes%0Amaybe+yes+or+no%0Ayes+maybe+or+yes%0Amaybe+yes+maybe+yes+maybe+or'
    9     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '%0A'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $6      
          5        ASSIGN                                                       !1, $6
   10     6        ASSIGN                                                       !2, <array>
   12     7      > FE_RESET_R                                           $9      !1, ->23
          8    > > FE_FETCH_R                                                   $9, !3, ->23
   13     9    >   INIT_FCALL                                                   'substr_count'
         10        SEND_VAR                                                     !3
         11        SEND_VAL                                                     'yes'
         12        DO_ICALL                                             $10     
         13        ASSIGN                                                       !4, $10
   14    14        IS_EQUAL                                             ~12     !4, 2
         15      > JMPZ_EX                                              ~12     ~12, ->19
         16    >   FRAMELESS_ICALL_2                strpos              ~13     !3, 'or'
         17        TYPE_CHECK                                      1018  ~14     ~13
         18        BOOL                                                 ~12     ~14
         19    > > JMPZ                                                         ~12, ->22
   15    20    >   ASSIGN_DIM                                                   !2
         21        OP_DATA                                                      !3
   12    22    > > JMP                                                          ->8
         23    >   FE_FREE                                                      $9
   19    24        FRAMELESS_ICALL_2                implode             ~16     '%0A', !2
         25        ECHO                                                         ~16
         26      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.48 ms | 2384 KiB | 15 Q