3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Finding Floats in an Array */ $arr = [ // Short String '123', // Long String '123 and another float at the end 123.23', // Mixed String '4.7 + 99 / 8...8 00.b', // Float 123.444, // Decimal 444, ]; $pattern = '%(\d+)?\.\d+%'; var_dump(preg_grep($pattern, $arr)); /* Find occurrences of either a space at the start of the string or a "ing" word */ $arr2 = [ "Examine she brother prudent add day ham.\n Far stairs now coming bed oppose hunted become his. You zealously departure had procuring suspicion. Books whose front would purse if be do\n decay. Quitting you way formerly disposed perceive ladyship are. Common turned boy direct and yet.", "Behind sooner dining so window excuse he summer. \n Breakfast met certainty and fulfilled propriety led. Waited get either are wooded little her. Contrasted unreserved as mr particular\n collecting it everything as indulgence. Seems ask meant merry could put. Age old begin had boy noisy table front whole given.", "Enjoying minutes related as at on on. Is dried as often me. Goodness as reserved raptures to mistaken steepest oh screened he. Gravity he mr sixteen esteems. Mile home its new way with high told said. Finished no horrible blessing landlord\n dwelling dissuade if. Rent fond am he in on read. Anxious cordial demands settled entered in do to colonel.", " <p>Remaining lively hardly needed at do by. Two you fat downs three.\n True mr gone most at. Dare as name just when with it body. Travelling inquietude she increasing off impossible the. Cottage be noisier looking to we promise on. Disposal to kindness appetite diverted learning of on raptures.<br> Betrayed any may returned now dashwood formerly. Balls way delay shy man views. No so instrument discretion unsatiable to in.</p>", ]; $pattern = '%^(\s+)|^(\w+)(ing)%'; var_dump(preg_grep($pattern, $arr2)); /* Invert results with Flag */ var_dump(preg_grep($pattern, $arr2, PREG_GREP_INVERT));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vbgfj
function name:  (null)
number of ops:  27
compiled vars:  !0 = $arr, !1 = $pattern, !2 = $arr2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, '%25%28%5Cd%2B%29%3F%5C.%5Cd%2B%25'
   20     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'preg_grep'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
   24     9        ASSIGN                                                   !2, <array>
   32    10        ASSIGN                                                   !1, '%25%5E%28%5Cs%2B%29%7C%5E%28%5Cw%2B%29%28ing%29%25'
   34    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'preg_grep'
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $9      
         16        SEND_VAR                                                 $9
         17        DO_ICALL                                                 
   37    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'preg_grep'
         20        SEND_VAR                                                 !1
         21        SEND_VAR                                                 !2
         22        SEND_VAL                                                 1
         23        DO_ICALL                                         $11     
         24        SEND_VAR                                                 $11
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.73 ms | 1395 KiB | 17 Q