3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getOptionOrElse(array $options, string $key, $else = false) { if (key_exists($key, $options) && $options[$key]['value'] !== '' && $options[$key]['value'] !== null) { return $options[$key]['value']; } return $else; } $abo_options = [ 'gedeelde bundel - belminuten per maand' => ['value' => 200], 'gedeelde bundel - sms per maand' => ['value' => 200], 'gedeelde bundel - mb per maand' => ['value' => 200] ]; //$minuten_sms_mb_amount = getOptionOrElse($abo_options,'gedeelde bundel - belminuten per maand', 0); //$minuten_sms_mb_amount += getOptionOrElse($abo_options,'gedeelde bundel - sms per maand', 0); //$minuten_sms_mb_amount += getOptionOrElse($abo_options,'gedeelde bundel - mb per maand', 0); $minuten_sms_mb_amount = getOptionOrElse($abo_options,'gedeelde bundel - belminuten per maand', 0); $minuten_sms_mb_amount += $minuten_sms_mb_amount === 0 ? getOptionOrElse($abo_options,'gedeelde bundel - sms per maand', 0) : 0; $minuten_sms_mb_amount += $minuten_sms_mb_amount === 0 ? getOptionOrElse($abo_options,'gedeelde bundel - mb per maand', 0) : 0; echo "amount: {$minuten_sms_mb_amount}";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
Branch analysis from position: 27
filename:       /in/NZ1qX
function name:  (null)
number of ops:  33
compiled vars:  !0 = $abo_options, !1 = $minuten_sms_mb_amount
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'getoptionorelse'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'gedeelde+bundel+-+belminuten+per+maand'
          4        SEND_VAL                                                 0
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !1, $3
   23     7        IS_IDENTICAL                                             !1, 0
          8      > JMPZ                                                     ~5, ->16
          9    >   INIT_FCALL                                               'getoptionorelse'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'gedeelde+bundel+-+sms+per+maand'
         12        SEND_VAL                                                 0
         13        DO_FCALL                                      0  $6      
         14        QM_ASSIGN                                        ~7      $6
         15      > JMP                                                      ->17
         16    >   QM_ASSIGN                                        ~7      0
         17    >   ASSIGN_OP                                     1          !1, ~7
   24    18        IS_IDENTICAL                                             !1, 0
         19      > JMPZ                                                     ~9, ->27
         20    >   INIT_FCALL                                               'getoptionorelse'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 'gedeelde+bundel+-+mb+per+maand'
         23        SEND_VAL                                                 0
         24        DO_FCALL                                      0  $10     
         25        QM_ASSIGN                                        ~11     $10
         26      > JMP                                                      ->28
         27    >   QM_ASSIGN                                        ~11     0
         28    >   ASSIGN_OP                                     1          !1, ~11
   26    29        NOP                                                      
         30        FAST_CONCAT                                      ~13     'amount%3A+', !1
         31        ECHO                                                     ~13
         32      > RETURN                                                   1

Function getoptionorelse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 12
filename:       /in/NZ1qX
function name:  getOptionOrElse
number of ops:  23
compiled vars:  !0 = $options, !1 = $key, !2 = $else
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
    5     3        INIT_FCALL                                               'key_exists'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7      > JMPZ_EX                                          ~4      $3, ->12
          8    >   FETCH_DIM_R                                      ~5      !0, !1
          9        FETCH_DIM_R                                      ~6      ~5, 'value'
         10        IS_NOT_IDENTICAL                                 ~7      ~6, ''
         11        BOOL                                             ~4      ~7
         12    > > JMPZ_EX                                          ~4      ~4, ->17
         13    >   FETCH_DIM_R                                      ~8      !0, !1
         14        FETCH_DIM_R                                      ~9      ~8, 'value'
         15        TYPE_CHECK                                  1020  ~10     ~9
         16        BOOL                                             ~4      ~10
         17    > > JMPZ                                                     ~4, ->21
    6    18    >   FETCH_DIM_R                                      ~11     !0, !1
         19        FETCH_DIM_R                                      ~12     ~11, 'value'
         20      > RETURN                                                   ~12
    8    21    > > RETURN                                                   !2
    9    22*     > RETURN                                                   null

End of function getoptionorelse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.24 ms | 1403 KiB | 18 Q