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>
Output for git.master, git.master_jit, rfc.property-hooks
<header class="entry-header container"> <h1 class="entry-title-house">House Sitting Days</h1> <span class="current-date">2020-06-25</span><!-- prints today's date--> // Line B <!-- English --> <span class="current-date-answer">No data available</span> // Line C </header>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
122.44 ms | 406 KiB | 5 Q