3v4l.org

run code in 300+ PHP versions simultaneously
<?php $standardPrice = 77.88; $specialPrices = json_decode('{"54.44":"20130515163000-20130515170000","4.88":"20130515170000-20130515190000","5.00":"20130515200000-20130515200045"}'); $currentPrice = function($standardPrice, $specialPrices) { if (empty($specialPrices)) { return $standardPrice; } $now = strftime('%Y%m%d%H%M%S'); foreach ($specialPrices as $price => &$interval) { list($min, $max) = explode('-', $interval); if ($now >= $min && $now <= $max ) { return $price; } } return $standardPrice; }; echo $currentPrice($standardPrice, $specialPrices);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Br9kD
function name:  (null)
number of ops:  13
compiled vars:  !0 = $standardPrice, !1 = $specialPrices, !2 = $currentPrice
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 77.88
    5     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAL                                                 '%7B%2254.44%22%3A%2220130515163000-20130515170000%22%2C%224.88%22%3A%2220130515170000-20130515190000%22%2C%225.00%22%3A%2220130515200000-20130515200045%22%7D'
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    8     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBr9kD%3A8%240'
          6        ASSIGN                                                   !2, ~6
   34     7        INIT_DYNAMIC_CALL                                        !2
          8        SEND_VAR_EX                                              !0
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0  $8      
         11        ECHO                                                     $8
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FBr9kD%3A8%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 125) Position 1 = 10, Position 2 = 29
Branch analysis from position: 10
2 jumps found. (Code = 126) Position 1 = 11, Position 2 = 29
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 28
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 25
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/Br9kD
function name:  {closure}
number of ops:  32
compiled vars:  !0 = $standardPrice, !1 = $specialPrices, !2 = $now, !3 = $interval, !4 = $price, !5 = $min, !6 = $max
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        ISSET_ISEMPTY_CV                                         !1
          3      > JMPZ                                                     ~7, ->5
   12     4    > > RETURN                                                   !0
   16     5    >   INIT_FCALL                                               'strftime'
          6        SEND_VAL                                                 '%25Y%25m%25d%25H%25M%25S'
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !2, $8
   21     9      > FE_RESET_RW                                      $10     !1, ->29
         10    > > FE_FETCH_RW                                      ~11     $10, !3, ->29
         11    >   ASSIGN                                                   !4, ~11
   23    12        INIT_FCALL                                               'explode'
         13        SEND_VAL                                                 '-'
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $13     
         16        FETCH_LIST_R                                     $14     $13, 0
         17        ASSIGN                                                   !5, $14
         18        FETCH_LIST_R                                     $16     $13, 1
         19        ASSIGN                                                   !6, $16
         20        FREE                                                     $13
   24    21        IS_SMALLER_OR_EQUAL                              ~18     !5, !2
         22      > JMPZ_EX                                          ~18     ~18, ->25
         23    >   IS_SMALLER_OR_EQUAL                              ~19     !2, !6
         24        BOOL                                             ~18     ~19
         25    > > JMPZ                                                     ~18, ->28
   25    26    >   FE_FREE                                                  $10
         27      > RETURN                                                   !4
   21    28    > > JMP                                                      ->10
         29    >   FE_FREE                                                  $10
   30    30      > RETURN                                                   !0
   32    31*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBr9kD%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
261.71 ms | 1400 KiB | 20 Q