3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ["post: 746", "post: 2", "post: 84"]; var_export(array_map(function($v){return filter_var($v, FILTER_SANITIZE_NUMBER_INT);}, $array)); // remove all non-integer characters var_export(preg_replace('~^post: ~', '', $array, 1)); // only necessary if you have non-"post: " substrings var_export(array_map(function($v){return trim($v, ': opst');}, $array)); // I shuffled the character mask to prove order doesn't matter
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3XiZH
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
    6     9        INIT_FCALL                                               'var_export'
         10        INIT_FCALL                                               'preg_replace'
         11        SEND_VAL                                                 '%7E%5Epost%3A+%7E'
         12        SEND_VAL                                                 ''
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 1
         15        DO_ICALL                                         $5      
         16        SEND_VAR                                                 $5
         17        DO_ICALL                                                 
    8    18        INIT_FCALL                                               'var_export'
         19        INIT_FCALL                                               'array_map'
         20        DECLARE_LAMBDA_FUNCTION                          ~7      [1]
         21        SEND_VAL                                                 ~7
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                         $8      
         24        SEND_VAR                                                 $8
         25        DO_ICALL                                                 
         26      > RETURN                                                   1


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

End of Dynamic Function 0

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

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.76 ms | 1020 KiB | 18 Q