3v4l.org

run code in 300+ 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 = 26
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 46) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 25
Branch analysis from position: 22
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/uL7fJ
function name:  (null)
number of ops:  33
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, ->26
          8    > > FE_FETCH_R                                               $9, !3, ->26
   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, ->22
         16    >   INIT_FCALL                                               'strpos'
         17        SEND_VAR                                                 !3
         18        SEND_VAL                                                 'or'
         19        DO_ICALL                                         $13     
         20        TYPE_CHECK                                  1018  ~14     $13
         21        BOOL                                             ~12     ~14
         22    > > JMPZ                                                     ~12, ->25
   15    23    >   ASSIGN_DIM                                               !2
         24        OP_DATA                                                  !3
   12    25    > > JMP                                                      ->8
         26    >   FE_FREE                                                  $9
   19    27        INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '%0A'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                         $16     
         31        ECHO                                                     $16
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.62 ms | 1009 KiB | 17 Q