3v4l.org

run code in 300+ PHP versions simultaneously
<?php function filter_ingredients($elements) { return implode(', ', array_filter(preg_split('/,\s*/', $elements), function ($v) { return !preg_match('/^no\b/', $v); })); } echo filter_ingredients("cheese, no tomato, no onion, mayo, no lettuce") . "\n"; echo filter_ingredients("no cheese, tomato, no onion, no&nbsp;mayo, lettuce") . "\n"; echo filter_ingredients("no cheese, no&nbsp;tomato, onion, no mayo, no lettuce") . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/smtbt
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'filter_ingredients'
          1        SEND_VAL                                                 'cheese%2C+++no+tomato%2C+no+onion%2C+mayo%2C+no+lettuce'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%0A'
          4        ECHO                                                     ~1
   11     5        INIT_FCALL                                               'filter_ingredients'
          6        SEND_VAL                                                 'no+cheese%2C+tomato%2C++no+onion%2C+no%26nbsp%3Bmayo%2C+lettuce'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%0A'
          9        ECHO                                                     ~3
   13    10        INIT_FCALL                                               'filter_ingredients'
         11        SEND_VAL                                                 'no+cheese%2C+no%26nbsp%3Btomato%2C+onion%2C+no+mayo%2C+no+lettuce'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%0A'
         14        ECHO                                                     ~5
         15      > RETURN                                                   1

Function filter_ingredients:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/smtbt
function name:  filter_ingredients
number of ops:  16
compiled vars:  !0 = $elements
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%2C+'
          3        INIT_FCALL                                               'array_filter'
          4        INIT_FCALL                                               'preg_split'
          5        SEND_VAL                                                 '%2F%2C%5Cs%2A%2F'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $1      
          8        SEND_VAR                                                 $1
          9        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
    6    10        SEND_VAL                                                 ~2
    4    11        DO_ICALL                                         $3      
    6    12        SEND_VAR                                                 $3
    4    13        DO_ICALL                                         $4      
    6    14      > RETURN                                                   $4
    7    15*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/smtbt
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5Eno%5Cb%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        BOOL_NOT                                         ~2      $1
          6      > RETURN                                                   ~2
    6     7*     > RETURN                                                   null

End of Dynamic Function 0

End of function filter_ingredients

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.98 ms | 1008 KiB | 20 Q