3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Jenny's garden is one of the best in town, it has lush greens and colorful flowers. With what happened to her recently, she could use a new sprinkler system so that she does not have to over exert herself. Perhaps Joel can sell that extra bike to raise money or perhaps put up a garage sale."; $keyword = "garden"; $length = 136; if ($keyword != "") { $strpos = strpos($string, $keyword); $strStart = substr($string, $strpos - ($length / 2), $length / 2); $strEnd = substr($string, $strpos + strlen($keyword), $length / 2); $result = $strStart . $keyword . $strEnd; } else { $result = substr($string, 0, $length); } echo $result;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 32
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PG9Kf
function name:  (null)
number of ops:  40
compiled vars:  !0 = $string, !1 = $keyword, !2 = $length, !3 = $strpos, !4 = $strStart, !5 = $strEnd, !6 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Jenny%27s+garden+is+one+of+the+best+in+town%2C+it+has+lush+greens+and+colorful+flowers.+With+what+happened+to+her+recently%2C+she+could+use+a+new+sprinkler+system+so+that+she+does+not+have+to+over+exert+herself.+Perhaps+Joel+can+sell+that+extra+bike+to+raise+money+or+perhaps+put+up+a+garage+sale.'
    4     1        ASSIGN                                                   !1, 'garden'
    6     2        ASSIGN                                                   !2, 136
    8     3        IS_NOT_EQUAL                                             !1, ''
          4      > JMPZ                                                     ~10, ->32
    9     5    >   INIT_FCALL                                               'strpos'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !3, $11
   10    10        INIT_FCALL                                               'substr'
         11        SEND_VAR                                                 !0
         12        DIV                                              ~13     !2, 2
         13        SUB                                              ~14     !3, ~13
         14        SEND_VAL                                                 ~14
         15        DIV                                              ~15     !2, 2
         16        SEND_VAL                                                 ~15
         17        DO_ICALL                                         $16     
         18        ASSIGN                                                   !4, $16
   11    19        INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !0
         21        STRLEN                                           ~18     !1
         22        ADD                                              ~19     !3, ~18
         23        SEND_VAL                                                 ~19
         24        DIV                                              ~20     !2, 2
         25        SEND_VAL                                                 ~20
         26        DO_ICALL                                         $21     
         27        ASSIGN                                                   !5, $21
   13    28        CONCAT                                           ~23     !4, !1
         29        CONCAT                                           ~24     ~23, !5
         30        ASSIGN                                                   !6, ~24
         31      > JMP                                                      ->38
   16    32    >   INIT_FCALL                                               'substr'
         33        SEND_VAR                                                 !0
         34        SEND_VAL                                                 0
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                         $26     
         37        ASSIGN                                                   !6, $26
   19    38    >   ECHO                                                     !6
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.32 ms | 1400 KiB | 17 Q