3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Mocking WordPress function add_filter(string $tag, callable $value) { $GLOBALS[$tag][] = $value; } function _doing_it_wrong($fn, string $message, string $ver) { echo "\n--------------\nDOING IT WRONG: $message\n--------------\n"; } // ------------------------------------------------------------------ function apply_filters_typesafe( $tag, $arguments = array(), $value = null, ...$values ) { if ( empty( $GLOBALS[$tag] ) ) { return $value; } static $types_map; if (!$types_map) { $types_map = [ 'boolean' => 'boolean', 'integer' => 'numeric', 'double' => 'numeric', 'string' => 'string', 'array' => 'array', 'resource' => 'resource', 'resource (closed)' => 'resource', 'NULL' => 'mixed', ]; } $type = gettype( $value ); $is_object = is_object( $value ); $accepted_types = isset( $types_map[ $type ] ) ? array( $types_map[ $type ] ) : array(); // Do not calculate multiple times for same class. static $classes_types = []; // Skip calculation of accepted types if they are are explicitly passed. if ( $is_object && empty ( $arguments['accepted_types'] ) ) { $class = get_class( $value ); if ( isset( $classes_types[ $class ] ) ) { $accepted_types = $classes_types[ $class ]; } else { $accepted_types = array( $class ); $parent = get_parent_class( $class ); while ( $parent ) { $accepted_types[] = $parent; $parent = get_parent_class( $parent ); } $accepted_types = array_merge( $accepted_types, class_implements( $class ) ); } $classes_types[ $class ] = $accepted_types; } $arguments = array_replace( array( 'nullable' => false, 'accepted_types' => $accepted_types ), $arguments ); $original = $value; // Objects are passed by ref, clone to return original unchanged in case of errors. $to_filter = $is_object ? clone $value : $value; $filter = array_shift($GLOBALS[$tag]); $filtered = $filter( $to_filter, ...$values ); // 'mixed' is a valid PHP 8 pseudo-type so we support for consistency. // That said, if mixed is fine then just use apply_filters. if ( in_array( 'mixed', (array)$arguments['accepted_types'] ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } static $can_do_it_wrong = false; if ( ! $can_do_it_wrong && function_exists( '_doing_it_wrong' ) ) { $can_do_it_wrong = true; } if ( null === $filtered ) { if ( !$arguments['nullable'] ) { $filtered = $original; if ( $can_do_it_wrong ) { _doing_it_wrong( __FUNCTION__, "Filters for '$tag' where not expected to return null.", '5.6' ); } } return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } static $functions; if ( ! $functions ) { $functions = array( 'int' => 'is_int', 'integer' => 'is_int', 'double' => 'is_float', 'float' => 'is_float', 'numeric' => 'is_numeric', 'number' => 'is_numeric', 'bool' => 'is_bool', 'boolean' => 'is_boolean', 'string' => 'is_string', 'array' => 'is_array', 'callable' => 'is_callable', 'function' => 'is_callable', 'resource' => 'is_resource', 'iterable' => 'is_iterable', 'countable' => 'is_countable', ); } foreach ( (array)$arguments['accepted_types'] as $type ) { if ( isset( $functions[ $type ] ) && call_user_func( $functions[ $type ], $filtered ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } if ( $is_object && is_string ( $type ) && is_a( $filtered, $type ) ) { return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $filtered, ...$values ) : $filtered; } } if ( $can_do_it_wrong ) { $expected = implode( "', '", $arguments['accepted_types'] ); $actual = is_object( $filtered ) ? 'instance of ' . get_class($filtered) : gettype( $filtered ); _doing_it_wrong( __FUNCTION__, "Filters for '$tag' where expected to return a value of one of types: '$expected'. Got '$actual' instead.", '5.6' ); } return $GLOBALS[$tag] ? apply_filters_typesafe( $tag, $arguments, $original, ...$values ) : $original; } // Let's try now to add some hooks, the first is bad, the second is good. add_filter('hello', function () { return 'This is not a callable' ; }); add_filter('hello', function () { return function () { return 'It works!'; }; }); // And lets' see if it works: $callable = apply_filters_typesafe('hello', ['accepted_types' => ['callable']], '__return_empty_string'); echo $callable(); echo "\n----------------------\n"; // Now, let's try with more filters and nullable. add_filter('answer', function () { return null; }); add_filter('answer', function (int $previous = null) { return $previous ?? 21; }); add_filter('answer', function (int $previous = null) { return ':troll:'; }); add_filter('answer', function (int $previous = null) { return $previous === null ? null : $previous * 2; }); $answer = apply_filters_typesafe('answer', ['accepted_types' => ['int'], 'nullable' => true], 0); printf('The answer is: %d.', $answer);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbMST
function name:  (null)
number of ops:  51
compiled vars:  !0 = $callable, !1 = $answer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  159     0  E >   INIT_FCALL                                               'add_filter'
          1        SEND_VAL                                                 'hello'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpbMST%3A159%240'
  161     3        SEND_VAL                                                 ~2
          4        DO_FCALL                                      0          
  163     5        INIT_FCALL                                               'add_filter'
          6        SEND_VAL                                                 'hello'
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpbMST%3A163%241'
  167     8        SEND_VAL                                                 ~4
          9        DO_FCALL                                      0          
  171    10        INIT_FCALL                                               'apply_filters_typesafe'
         11        SEND_VAL                                                 'hello'
         12        SEND_VAL                                                 <array>
         13        SEND_VAL                                                 '__return_empty_string'
         14        DO_FCALL                                      0  $6      
         15        ASSIGN                                                   !0, $6
  172    16        INIT_DYNAMIC_CALL                                        !0
         17        DO_FCALL                                      0  $8      
         18        ECHO                                                     $8
  174    19        ECHO                                                     '%0A----------------------%0A'
  179    20        INIT_FCALL                                               'add_filter'
         21        SEND_VAL                                                 'answer'
         22        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpbMST%3A179%243'
  181    23        SEND_VAL                                                 ~9
         24        DO_FCALL                                      0          
  183    25        INIT_FCALL                                               'add_filter'
         26        SEND_VAL                                                 'answer'
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpbMST%3A183%244'
  185    28        SEND_VAL                                                 ~11
         29        DO_FCALL                                      0          
  187    30        INIT_FCALL                                               'add_filter'
         31        SEND_VAL                                                 'answer'
         32        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpbMST%3A187%245'
  189    33        SEND_VAL                                                 ~13
         34        DO_FCALL                                      0          
  191    35        INIT_FCALL                                               'add_filter'
         36        SEND_VAL                                                 'answer'
         37        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FpbMST%3A191%246'
  193    38        SEND_VAL                                                 ~15
         39        DO_FCALL                                      0          
  195    40        INIT_FCALL                                               'apply_filters_typesafe'
         41        SEND_VAL                                                 'answer'
         42        SEND_VAL                                                 <array>
         43        SEND_VAL                                                 0
         44        DO_FCALL                                      0  $17     
         45        ASSIGN                                                   !1, $17
  196    46        INIT_FCALL                                               'printf'
         47        SEND_VAL                                                 'The+answer+is%3A+%25d.'
         48        SEND_VAR                                                 !1
         49        DO_ICALL                                                 
         50      > RETURN                                                   1

Function add_filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbMST
function name:  add_filter
number of ops:  7
compiled vars:  !0 = $tag, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        FETCH_W                      global              $2      'GLOBALS'
          3        FETCH_DIM_W                                      $3      $2, !0
          4        ASSIGN_DIM                                               $3
          5        OP_DATA                                                  !1
    6     6      > RETURN                                                   null

End of function add_filter

Function _doing_it_wrong:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbMST
function name:  _doing_it_wrong
number of ops:  8
compiled vars:  !0 = $fn, !1 = $message, !2 = $ver
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    9     3        ROPE_INIT                                     3  ~4      '%0A--------------%0ADOING+IT+WRONG%3A+'
          4        ROPE_ADD                                      1  ~4      ~4, !1
          5        ROPE_END                                      2  ~3      ~4, '%0A--------------%0A'
          6        ECHO                                                     ~3
   10     7      > RETURN                                                   null

End of function _doing_it_wrong

Function apply_filters_typesafe:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 60
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 72
Branch analysis from position: 69
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
2 jumps found. (Code = 43) Position 1 = 93, Position 2 = 107
Branch analysis from position: 93
2 jumps found. (Code = 43) Position 1 = 96, Position 2 = 105
Branch analysis from position: 96
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 105
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 107
2 jumps found. (Code = 46) Position 1 = 110, Position 2 = 114
Branch analysis from position: 110
2 jumps found. (Code = 43) Position 1 = 115, Position 2 = 116
Branch analysis from position: 115
2 jumps found. (Code = 43) Position 1 = 118, Position 2 = 145
Branch analysis from position: 118
2 jumps found. (Code = 43) Position 1 = 121, Position 2 = 131
Branch analysis from position: 121
2 jumps found. (Code = 43) Position 1 = 123, Position 2 = 131
Branch analysis from position: 123
2 jumps found. (Code = 43) Position 1 = 134, Position 2 = 143
Branch analysis from position: 134
1 jumps found. (Code = 42) Position 1 = 144
Branch analysis from position: 144
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 143
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 131
Branch analysis from position: 131
Branch analysis from position: 145
2 jumps found. (Code = 43) Position 1 = 148, Position 2 = 149
Branch analysis from position: 148
2 jumps found. (Code = 77) Position 1 = 152, Position 2 = 202
Branch analysis from position: 152
2 jumps found. (Code = 78) Position 1 = 153, Position 2 = 202
Branch analysis from position: 153
2 jumps found. (Code = 46) Position 1 = 155, Position 2 = 160
Branch analysis from position: 155
2 jumps found. (Code = 43) Position 1 = 161, Position 2 = 176
Branch analysis from position: 161
2 jumps found. (Code = 43) Position 1 = 164, Position 2 = 173
Branch analysis from position: 164
1 jumps found. (Code = 42) Position 1 = 174
Branch analysis from position: 174
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 173
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 176
2 jumps found. (Code = 46) Position 1 = 177, Position 2 = 179
Branch analysis from position: 177
2 jumps found. (Code = 46) Position 1 = 180, Position 2 = 185
Branch analysis from position: 180
2 jumps found. (Code = 43) Position 1 = 186, Position 2 = 201
Branch analysis from position: 186
2 jumps found. (Code = 43) Position 1 = 189, Position 2 = 198
Branch analysis from position: 189
1 jumps found. (Code = 42) Position 1 = 199
Branch analysis from position: 199
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 198
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 201
1 jumps found. (Code = 42) Position 1 = 152
Branch analysis from position: 152
Branch analysis from position: 185
Branch analysis from position: 179
Branch analysis from position: 160
Branch analysis from position: 202
2 jumps found. (Code = 43) Position 1 = 204, Position 2 = 231
Branch analysis from position: 204
2 jumps found. (Code = 43) Position 1 = 212, Position 2 = 216
Branch analysis from position: 212
1 jumps found. (Code = 42) Position 1 = 218
Branch analysis from position: 218
2 jumps found. (Code = 43) Position 1 = 234, Position 2 = 243
Branch analysis from position: 234
1 jumps found. (Code = 42) Position 1 = 244
Branch analysis from position: 244
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 243
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 216
2 jumps found. (Code = 43) Position 1 = 234, Position 2 = 243
Branch analysis from position: 234
Branch analysis from position: 243
Branch analysis from position: 231
Branch analysis from position: 202
Branch analysis from position: 149
Branch analysis from position: 116
Branch analysis from position: 114
Branch analysis from position: 72
2 jumps found. (Code = 43) Position 1 = 93, Position 2 = 107
Branch analysis from position: 93
Branch analysis from position: 107
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 43
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 72
Branch analysis from position: 69
Branch analysis from position: 72
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 43
Branch analysis from position: 50
Branch analysis from position: 43
Branch analysis from position: 60
Branch analysis from position: 28
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
Branch analysis from position: 28
Branch analysis from position: 12
filename:       /in/pbMST
function name:  apply_filters_typesafe
number of ops:  246
compiled vars:  !0 = $tag, !1 = $arguments, !2 = $value, !3 = $values, !4 = $types_map, !5 = $type, !6 = $is_object, !7 = $accepted_types, !8 = $classes_types, !9 = $class, !10 = $parent, !11 = $original, !12 = $to_filter, !13 = $filter, !14 = $filtered, !15 = $can_do_it_wrong, !16 = $functions, !17 = $expected, !18 = $actual
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
          2        RECV_INIT                                        !2      null
          3        RECV_VARIADIC                                    !3      
   16     4        FETCH_IS                                         ~19     'GLOBALS'
          5        ISSET_ISEMPTY_DIM_OBJ                         1          ~19, !0
          6      > JMPZ                                                     ~20, ->8
   17     7    > > RETURN                                                   !2
   20     8    >   BIND_STATIC                                              !4
   21     9        BOOL_NOT                                         ~21     !4
         10      > JMPZ                                                     ~21, ->12
   22    11    >   ASSIGN                                                   !4, <array>
   34    12    >   GET_TYPE                                         ~23     !2
         13        ASSIGN                                                   !5, ~23
   35    14        TYPE_CHECK                                  256  ~25     !2
         15        ASSIGN                                                   !6, ~25
   36    16        ISSET_ISEMPTY_DIM_OBJ                         0          !4, !5
         17      > JMPZ                                                     ~27, ->22
         18    >   FETCH_DIM_R                                      ~28     !4, !5
         19        INIT_ARRAY                                       ~29     ~28
         20        QM_ASSIGN                                        ~30     ~29
         21      > JMP                                                      ->23
         22    >   QM_ASSIGN                                        ~30     <array>
         23    >   ASSIGN                                                   !7, ~30
   39    24        BIND_STATIC                                              !8
   41    25      > JMPZ_EX                                          ~32     !6, ->28
         26    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~33     !1, 'accepted_types'
         27        BOOL                                             ~32     ~33
         28    > > JMPZ                                                     ~32, ->60
   42    29    >   GET_CLASS                                        ~34     !2
         30        ASSIGN                                                   !9, ~34
   43    31        ISSET_ISEMPTY_DIM_OBJ                         0          !8, !9
         32      > JMPZ                                                     ~36, ->36
   44    33    >   FETCH_DIM_R                                      ~37     !8, !9
         34        ASSIGN                                                   !7, ~37
         35      > JMP                                                      ->58
   46    36    >   INIT_ARRAY                                       ~39     !9
         37        ASSIGN                                                   !7, ~39
   47    38        INIT_FCALL                                               'get_parent_class'
         39        SEND_VAR                                                 !9
         40        DO_ICALL                                         $41     
         41        ASSIGN                                                   !10, $41
   48    42      > JMP                                                      ->49
   49    43    >   ASSIGN_DIM                                               !7
         44        OP_DATA                                                  !10
   50    45        INIT_FCALL                                               'get_parent_class'
         46        SEND_VAR                                                 !10
         47        DO_ICALL                                         $44     
         48        ASSIGN                                                   !10, $44
   48    49    > > JMPNZ                                                    !10, ->43
   53    50    >   INIT_FCALL                                               'array_merge'
         51        SEND_VAR                                                 !7
         52        INIT_FCALL                                               'class_implements'
         53        SEND_VAR                                                 !9
         54        DO_ICALL                                         $46     
         55        SEND_VAR                                                 $46
         56        DO_ICALL                                         $47     
         57        ASSIGN                                                   !7, $47
   56    58    >   ASSIGN_DIM                                               !8, !9
         59        OP_DATA                                                  !7
   59    60    >   INIT_FCALL                                               'array_replace'
   61    61        INIT_ARRAY                                       ~50     <false>, 'nullable'
   62    62        ADD_ARRAY_ELEMENT                                ~50     !7, 'accepted_types'
         63        SEND_VAL                                                 ~50
   64    64        SEND_VAR                                                 !1
         65        DO_ICALL                                         $51     
   59    66        ASSIGN                                                   !1, $51
   67    67        ASSIGN                                                   !11, !2
   69    68      > JMPZ                                                     !6, ->72
         69    >   CLONE                                            ~54     !2
         70        QM_ASSIGN                                        ~55     ~54
         71      > JMP                                                      ->73
         72    >   QM_ASSIGN                                        ~55     !2
         73    >   ASSIGN                                                   !12, ~55
   71    74        INIT_FCALL                                               'array_shift'
         75        FETCH_W                      global              $57     'GLOBALS'
         76        FETCH_DIM_W                                      $58     $57, !0
         77        SEND_REF                                                 $58
         78        DO_ICALL                                         $59     
         79        ASSIGN                                                   !13, $59
   73    80        INIT_DYNAMIC_CALL                                        !13
         81        SEND_VAR_EX                                              !12
         82        SEND_UNPACK                                              !3
         83        CHECK_UNDEF_ARGS                                         
         84        DO_FCALL                                      1  $61     
         85        ASSIGN                                                   !14, $61
   77    86        INIT_FCALL                                               'in_array'
         87        SEND_VAL                                                 'mixed'
         88        FETCH_DIM_R                                      ~63     !1, 'accepted_types'
         89        CAST                                          7  ~64     ~63
         90        SEND_VAL                                                 ~64
         91        DO_ICALL                                         $65     
         92      > JMPZ                                                     $65, ->107
   78    93    >   FETCH_R                      global              ~66     'GLOBALS'
         94        FETCH_DIM_R                                      ~67     ~66, !0
         95      > JMPZ                                                     ~67, ->105
   79    96    >   INIT_FCALL_BY_NAME                                       'apply_filters_typesafe'
         97        SEND_VAR_EX                                              !0
         98        SEND_VAR_EX                                              !1
         99        SEND_VAR_EX                                              !14
        100        SEND_UNPACK                                              !3
        101        CHECK_UNDEF_ARGS                                         
        102        DO_FCALL                                      1  $68     
        103        QM_ASSIGN                                        ~69     $68
        104      > JMP                                                      ->106
   80   105    >   QM_ASSIGN                                        ~69     !14
        106    > > RETURN                                                   ~69
   83   107    >   BIND_STATIC                                              !15
   84   108        BOOL_NOT                                         ~70     !15
        109      > JMPZ_EX                                          ~70     ~70, ->114
        110    >   INIT_FCALL                                               'function_exists'
        111        SEND_VAL                                                 '_doing_it_wrong'
        112        DO_ICALL                                         $71     
        113        BOOL                                             ~70     $71
        114    > > JMPZ                                                     ~70, ->116
   85   115    >   ASSIGN                                                   !15, <true>
   88   116    >   TYPE_CHECK                                    2          !14
        117      > JMPZ                                                     ~73, ->145
   89   118    >   FETCH_DIM_R                                      ~74     !1, 'nullable'
        119        BOOL_NOT                                         ~75     ~74
        120      > JMPZ                                                     ~75, ->131
   90   121    >   ASSIGN                                                   !14, !11
   92   122      > JMPZ                                                     !15, ->131
   93   123    >   INIT_FCALL                                               '_doing_it_wrong'
   94   124        SEND_VAL                                                 'apply_filters_typesafe'
   95   125        ROPE_INIT                                     3  ~78     'Filters+for+%27'
        126        ROPE_ADD                                      1  ~78     ~78, !0
        127        ROPE_END                                      2  ~77     ~78, '%27+where+not+expected+to+return+null.'
        128        SEND_VAL                                                 ~77
   96   129        SEND_VAL                                                 '5.6'
        130        DO_FCALL                                      0          
  101   131    >   FETCH_R                      global              ~81     'GLOBALS'
        132        FETCH_DIM_R                                      ~82     ~81, !0
        133      > JMPZ                                                     ~82, ->143
  102   134    >   INIT_FCALL_BY_NAME                                       'apply_filters_typesafe'
        135        SEND_VAR_EX                                              !0
        136        SEND_VAR_EX                                              !1
        137        SEND_VAR_EX                                              !14
        138        SEND_UNPACK                                              !3
        139        CHECK_UNDEF_ARGS                                         
        140        DO_FCALL                                      1  $83     
        141        QM_ASSIGN                                        ~84     $83
        142      > JMP                                                      ->144
  103   143    >   QM_ASSIGN                                        ~84     !14
        144    > > RETURN                                                   ~84
  106   145    >   BIND_STATIC                                              !16
  107   146        BOOL_NOT                                         ~85     !16
        147      > JMPZ                                                     ~85, ->149
  108   148    >   ASSIGN                                                   !16, <array>
  127   149    >   FETCH_DIM_R                                      ~87     !1, 'accepted_types'
        150        CAST                                          7  ~88     ~87
        151      > FE_RESET_R                                       $89     ~88, ->202
        152    > > FE_FETCH_R                                               $89, !5, ->202
  128   153    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~90     !16, !5
        154      > JMPZ_EX                                          ~90     ~90, ->160
        155    >   FETCH_DIM_R                                      ~91     !16, !5
        156        INIT_USER_CALL                                1          'call_user_func', ~91
        157        SEND_USER                                                !14
        158        DO_FCALL                                      0  $92     
        159        BOOL                                             ~90     $92
        160    > > JMPZ                                                     ~90, ->176
  129   161    >   FETCH_R                      global              ~93     'GLOBALS'
        162        FETCH_DIM_R                                      ~94     ~93, !0
        163      > JMPZ                                                     ~94, ->173
  130   164    >   INIT_FCALL_BY_NAME                                       'apply_filters_typesafe'
        165        SEND_VAR_EX                                              !0
        166        SEND_VAR_EX                                              !1
        167        SEND_VAR_EX                                              !14
        168        SEND_UNPACK                                              !3
        169        CHECK_UNDEF_ARGS                                         
        170        DO_FCALL                                      1  $95     
        171        QM_ASSIGN                                        ~96     $95
        172      > JMP                                                      ->174
  131   173    >   QM_ASSIGN                                        ~96     !14
        174    >   FE_FREE                                                  $89
        175      > RETURN                                                   ~96
  134   176    > > JMPZ_EX                                          ~97     !6, ->179
        177    >   TYPE_CHECK                                   64  ~98     !5
        178        BOOL                                             ~97     ~98
        179    > > JMPZ_EX                                          ~97     ~97, ->185
        180    >   INIT_FCALL                                               'is_a'
        181        SEND_VAR                                                 !14
        182        SEND_VAR                                                 !5
        183        DO_ICALL                                         $99     
        184        BOOL                                             ~97     $99
        185    > > JMPZ                                                     ~97, ->201
  135   186    >   FETCH_R                      global              ~100    'GLOBALS'
        187        FETCH_DIM_R                                      ~101    ~100, !0
        188      > JMPZ                                                     ~101, ->198
  136   189    >   INIT_FCALL_BY_NAME                                       'apply_filters_typesafe'
        190        SEND_VAR_EX                                              !0
        191        SEND_VAR_EX                                              !1
        192        SEND_VAR_EX                                              !14
        193        SEND_UNPACK                                              !3
        194        CHECK_UNDEF_ARGS                                         
        195        DO_FCALL                                      1  $102    
        196        QM_ASSIGN                                        ~103    $102
        197      > JMP                                                      ->199
  137   198    >   QM_ASSIGN                                        ~103    !14
        199    >   FE_FREE                                                  $89
        200      > RETURN                                                   ~103
  127   201    > > JMP                                                      ->152
        202    >   FE_FREE                                                  $89
  141   203      > JMPZ                                                     !15, ->231
  142   204    >   INIT_FCALL                                               'implode'
        205        SEND_VAL                                                 '%27%2C+%27'
        206        FETCH_DIM_R                                      ~104    !1, 'accepted_types'
        207        SEND_VAL                                                 ~104
        208        DO_ICALL                                         $105    
        209        ASSIGN                                                   !17, $105
  143   210        TYPE_CHECK                                  256          !14
        211      > JMPZ                                                     ~107, ->216
        212    >   GET_CLASS                                        ~108    !14
        213        CONCAT                                           ~109    'instance+of+', ~108
        214        QM_ASSIGN                                        ~110    ~109
        215      > JMP                                                      ->218
        216    >   GET_TYPE                                         ~111    !14
        217        QM_ASSIGN                                        ~110    ~111
        218    >   ASSIGN                                                   !18, ~110
  144   219        INIT_FCALL                                               '_doing_it_wrong'
  145   220        SEND_VAL                                                 'apply_filters_typesafe'
  146   221        ROPE_INIT                                     7  ~114    'Filters+for+%27'
        222        ROPE_ADD                                      1  ~114    ~114, !0
        223        ROPE_ADD                                      2  ~114    ~114, '%27+where+expected+to+return+a+value+of+one+of+types%3A+%27'
        224        ROPE_ADD                                      3  ~114    ~114, !17
        225        ROPE_ADD                                      4  ~114    ~114, '%27.+Got+%27'
        226        ROPE_ADD                                      5  ~114    ~114, !18
        227        ROPE_END                                      6  ~113    ~114, '%27+instead.'
        228        SEND_VAL                                                 ~113
  147   229        SEND_VAL                                                 '5.6'
        230        DO_FCAL

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
201.44 ms | 1431 KiB | 43 Q