3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = str_split("1A1R0A"); $arr = (object) array( 'numeric' => array_filter($str, function($char) { return is_numeric($char); }), 'character' => array_filter($str, function($char) { return !is_numeric($char); }), ); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2I5tn
function name:  (null)
number of ops:  22
compiled vars:  !0 = $str, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'str_split'
          1        SEND_VAL                                                 '1A1R0A'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    7     4        INIT_FCALL                                               'array_filter'
          5        SEND_VAR                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
    9     7        SEND_VAL                                                 ~4
    7     8        DO_ICALL                                         $5      
    9     9        INIT_ARRAY                                       ~6      $5, 'numeric'
   10    10        INIT_FCALL                                               'array_filter'
         11        SEND_VAR                                                 !0
         12        DECLARE_LAMBDA_FUNCTION                          ~7      [1]
   12    13        SEND_VAL                                                 ~7
   10    14        DO_ICALL                                         $8      
   12    15        ADD_ARRAY_ELEMENT                                ~6      $8, 'character'
         16        CAST                                          8  ~9      ~6
    6    17        ASSIGN                                                   !1, ~9
   15    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > 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/2I5tn
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    9     5*     > 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/2I5tn
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        BOOL_NOT                                         ~2      $1
          5      > RETURN                                                   ~2
   12     6*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.67 ms | 1002 KiB | 17 Q