3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { const FLOWS_EMAIL_TYPE_ACTION = 'foo'; function __construct(array $steps) { $email_actions = array_reduce( $steps, fn($result, $step) => $result + (($step['settings']['type'] ?? null) === self::FLOWS_EMAIL_TYPE_ACTION), 0 ); var_export($email_actions); } } new Test([ ['settings' => ['type' => 'bar']], ['settings' => ['type' => 'foo']], [], ['settings' => ['type' => 'foo']], ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQST2
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $0      'Test'
   20     1        SEND_VAL_EX                                              <array>
   19     2        DO_FCALL                                      0          
   20     3        FREE                                                     $0
   24     4      > RETURN                                                   1

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fQST2
function name:  __construct
number of ops:  12
compiled vars:  !0 = $steps, !1 = $email_actions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'array_reduce'
   10     2        SEND_VAR                                                 !0
   11     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   12     4        SEND_VAL                                                 ~2
   13     5        SEND_VAL                                                 0
    9     6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !1, $3
   15     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   16    11      > 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/fQST2
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $result, !1 = $step
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        FETCH_DIM_IS                                     ~2      !1, 'settings'
          3        FETCH_DIM_IS                                     ~3      ~2, 'type'
          4        COALESCE                                         ~4      ~3
          5        QM_ASSIGN                                        ~4      null
          6        FETCH_CLASS_CONSTANT                             ~5      'FLOWS_EMAIL_TYPE_ACTION'
          7        IS_IDENTICAL                                     ~6      ~4, ~5
          8        ADD                                              ~7      !0, ~6
          9      > RETURN                                                   ~7
         10*     > RETURN                                                   null

End of Dynamic Function 0

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
129.18 ms | 1002 KiB | 15 Q