3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('ICL_LANGUAGE_CODE', 'en'); function the_title($str1, $str2) { echo $str1 . "House Sitting Days" . $str2; } $json = '{ "house_sitting_date_current_month": ["2020-02-01", "2020-02-02", "2020-02-03", "2020-02-04", "2020-02-05", "2020-02-06"], "house_sitting_date_yes_no_current_month": ["yes", "nada", "nada", "nada", "yes", "yes"], "house_sitting_date_next_month": ["2020-03-01", "2020-03-02", "2020-03-03", "2020-03-04", "2020-03-05", "2020-03-06"], "house_sitting_date_yes_no_next_month": ["no", "yes", "yes", "nada", "nada", "nada"], "toggle_status": null }'; $data_house = json_decode($json); $date = date("Y-m-d"); $sitting_day_str_en = "Sitting day"; $not_a_sitting_day_str_en ="Not a Sitting Day"; if (($k = array_search($date, $data_house->house_sitting_date_current_month)) !== false) { $sitting = $data_house->house_sitting_date_yes_no_current_month[$k]; $sitting_str_en = $sitting == 'yes' ? $sitting_day_str_en : ($sitting == 'no' ? $not_a_sitting_day_str_en : ''); } elseif (($k = array_search($date, $data_house->house_sitting_date_next_month)) !== false) { $sitting = $data_house->house_sitting_date_yes_no_next_month[$k]; $sitting_str_en = $sitting == 'yes' ? $sitting_day_str_en : ($sitting == 'no' ? $not_a_sitting_day_str_en : ''); } else { // not found $sitting_str_en = 'No data available'; } ?> <header class="entry-header container"> <?php the_title('<h1 class="entry-title-house">', '</h1>'); ?> <span class="current-date"><?php echo $date ?></span><!-- prints today's date--> // Line B <?php if (ICL_LANGUAGE_CODE == 'en') { ?> <!-- English --> <span class="current-date-answer"><?= $sitting_str_en ?></span> // Line C <?php } ?> </header>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 38
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 76
Branch analysis from position: 73
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 76
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 61
Branch analysis from position: 46
2 jumps found. (Code = 43) Position 1 = 51, Position 2 = 53
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 53
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 57
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 62
Branch analysis from position: 62
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 76
Branch analysis from position: 73
Branch analysis from position: 76
filename:       /in/kfCUX
function name:  (null)
number of ops:  78
compiled vars:  !0 = $json, !1 = $data_house, !2 = $date, !3 = $sitting_day_str_en, !4 = $not_a_sitting_day_str_en, !5 = $k, !6 = $sitting, !7 = $sitting_str_en
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'ICL_LANGUAGE_CODE'
          2        SEND_VAL                                                 'en'
          3        DO_ICALL                                                 
    8     4        ASSIGN                                                   !0, '%7B%0A++++%22house_sitting_date_current_month%22%3A+%5B%222020-02-01%22%2C+%222020-02-02%22%2C+%222020-02-03%22%2C+%222020-02-04%22%2C+%222020-02-05%22%2C+%222020-02-06%22%5D%2C%0A++++%22house_sitting_date_yes_no_current_month%22%3A+%5B%22yes%22%2C+%22nada%22%2C+%22nada%22%2C+%22nada%22%2C+%22yes%22%2C+%22yes%22%5D%2C%0A++++%22house_sitting_date_next_month%22%3A+%5B%222020-03-01%22%2C+%222020-03-02%22%2C+%222020-03-03%22%2C+%222020-03-04%22%2C+%222020-03-05%22%2C+%222020-03-06%22%5D%2C%0A++++%22house_sitting_date_yes_no_next_month%22%3A+%5B%22no%22%2C+%22yes%22%2C+%22yes%22%2C+%22nada%22%2C+%22nada%22%2C+%22nada%22%5D%2C%0A++++%22toggle_status%22%3A+null%0A%7D'
   15     5        INIT_FCALL                                               'json_decode'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $10     
          8        ASSIGN                                                   !1, $10
   16     9        INIT_FCALL                                               'date'
         10        SEND_VAL                                                 'Y-m-d'
         11        DO_ICALL                                         $12     
         12        ASSIGN                                                   !2, $12
   18    13        ASSIGN                                                   !3, 'Sitting+day'
   20    14        ASSIGN                                                   !4, 'Not+a+Sitting+Day'
   22    15        INIT_FCALL                                               'array_search'
         16        SEND_VAR                                                 !2
         17        FETCH_OBJ_R                                      ~16     !1, 'house_sitting_date_current_month'
         18        SEND_VAL                                                 ~16
         19        DO_ICALL                                         $17     
         20        ASSIGN                                           ~18     !5, $17
         21        TYPE_CHECK                                  1018          ~18
         22      > JMPZ                                                     ~19, ->38
   23    23    >   FETCH_OBJ_R                                      ~20     !1, 'house_sitting_date_yes_no_current_month'
         24        FETCH_DIM_R                                      ~21     ~20, !5
         25        ASSIGN                                                   !6, ~21
   24    26        IS_EQUAL                                                 !6, 'yes'
         27      > JMPZ                                                     ~23, ->30
         28    >   QM_ASSIGN                                        ~24     !3
         29      > JMP                                                      ->36
         30    >   IS_EQUAL                                                 !6, 'no'
         31      > JMPZ                                                     ~25, ->34
         32    >   QM_ASSIGN                                        ~26     !4
         33      > JMP                                                      ->35
         34    >   QM_ASSIGN                                        ~26     ''
         35    >   QM_ASSIGN                                        ~24     ~26
         36    >   ASSIGN                                                   !7, ~24
   22    37      > JMP                                                      ->62
   26    38    >   INIT_FCALL                                               'array_search'
         39        SEND_VAR                                                 !2
         40        FETCH_OBJ_R                                      ~28     !1, 'house_sitting_date_next_month'
         41        SEND_VAL                                                 ~28
         42        DO_ICALL                                         $29     
         43        ASSIGN                                           ~30     !5, $29
         44        TYPE_CHECK                                  1018          ~30
         45      > JMPZ                                                     ~31, ->61
   27    46    >   FETCH_OBJ_R                                      ~32     !1, 'house_sitting_date_yes_no_next_month'
         47        FETCH_DIM_R                                      ~33     ~32, !5
         48        ASSIGN                                                   !6, ~33
   28    49        IS_EQUAL                                                 !6, 'yes'
         50      > JMPZ                                                     ~35, ->53
         51    >   QM_ASSIGN                                        ~36     !3
         52      > JMP                                                      ->59
         53    >   IS_EQUAL                                                 !6, 'no'
         54      > JMPZ                                                     ~37, ->57
         55    >   QM_ASSIGN                                        ~38     !4
         56      > JMP                                                      ->58
         57    >   QM_ASSIGN                                        ~38     ''
         58    >   QM_ASSIGN                                        ~36     ~38
         59    >   ASSIGN                                                   !7, ~36
   26    60      > JMP                                                      ->62
   32    61    >   ASSIGN                                                   !7, 'No+data+available'
   36    62    >   ECHO                                                     '%0A%3Cheader+class%3D%22entry-header+container%22%3E%0A+++'
   39    63        INIT_FCALL                                               'the_title'
         64        SEND_VAL                                                 '%3Ch1+class%3D%22entry-title-house%22%3E'
         65        SEND_VAL                                                 '%3C%2Fh1%3E'
         66        DO_FCALL                                      0          
   41    67        ECHO                                                     '+++%3Cspan+class%3D%22current-date%22%3E'
         68        ECHO                                                     !2
         69        ECHO                                                     '%3C%2Fspan%3E%3C%21--+prints+today%27s+date--%3E+%2F%2F+Line+B+%0A+++++++++'
   42    70        FETCH_CONSTANT                                   ~42     'ICL_LANGUAGE_CODE'
         71        IS_EQUAL                                                 ~42, 'en'
         72      > JMPZ                                                     ~43, ->76
         73    >   ECHO                                                     '++++++++%3C%21--+English+--%3E%0A++++++++++++++++%3Cspan+class%3D%22current-date-answer%22%3E'
   43    74        ECHO                                                     !7
         75        ECHO                                                     '%3C%2Fspan%3E+%2F%2F+Line+C+++++++++++++++++++++++++++%0A++++++++'
   45    76    >   ECHO                                                     '%3C%2Fheader%3E'
         77      > RETURN                                                   1

Function the_title:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kfCUX
function name:  the_title
number of ops:  6
compiled vars:  !0 = $str1, !1 = $str2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        CONCAT                                           ~2      !0, 'House+Sitting+Days'
          3        CONCAT                                           ~3      ~2, !1
          4        ECHO                                                     ~3
    6     5      > RETURN                                                   null

End of function the_title

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.67 ms | 1014 KiB | 18 Q