3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function the_title() { return 'A Title';} function the_permalink() { return 'https://google.com';} function has_post_thumbnail() { return true;} function the_post_thumbnail($whateverThisIs) { return '<img src="https://upload.wikimedia.org/wikipedia/en/2/22/Charlie_Brown.png" />'; } function get_post_custom_values() { $key = 'Gal_IMG'; $value = 'https://en.wikipedia.org/wiki/Main_Page#/media/File:BepiColombo_spacecraft_model.png'; return 'https://en.wikipedia.org/wiki/Main_Page#/media/File:BepiColombo_spacecraft_model.png'; } $imgClass = 'no-img'; $img = ''; $title = the_title(); $link = the_permalink(); // $BG_Img = get_post_custom_values('GalIMG') ; if(has_post_thumbnail()) { $imgClass = ''; $img = the_post_thumbnail('alm-thumbnail'); } echo " <li class='${imgClass}'> ${img} <h3> <a href='${link}' style='background-image:url('${BG_Img}'); display:block;'>${title} </a> </h3> </li> "; ?> <li class="<?= $imgClass ?>"> <?= $img ?> <h3> <a href="<?= $link ?>" style="background-image:url('<?= $BG_Img ?>'); display:block;"><?= $title ?></a> </h3> </li>
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.25, 8.0.0 - 8.0.12, 8.1rc1 - rc3
<li class=''> <img src="https://upload.wikimedia.org/wikipedia/en/2/22/Charlie_Brown.png" /> <h3> <a href='https://google.com' style='background-image:url('https://en.wikipedia.org/wiki/Main_Page#/media/File:BepiColombo_spacecraft_model.png'); display:block;'>A Title </a> </h3> </li> <li class=""> <img src="https://upload.wikimedia.org/wikipedia/en/2/22/Charlie_Brown.png" /> <h3> <a href="https://google.com" style="background-image:url('https://en.wikipedia.org/wiki/Main_Page#/media/File:BepiColombo_spacecraft_model.png'); display:block;">A Title</a> </h3> </li>
Output for 5.6.38
Warning: Unsupported declare 'strict_types' in /in/XngMi on line 1 <li class=''> <img src="https://upload.wikimedia.org/wikipedia/en/2/22/Charlie_Brown.png" /> <h3> <a href='https://google.com' style='background-image:url('https://en.wikipedia.org/wiki/Main_Page#/media/File:BepiColombo_spacecraft_model.png'); display:block;'>A Title </a> </h3> </li> <li class=""> <img src="https://upload.wikimedia.org/wikipedia/en/2/22/Charlie_Brown.png" /> <h3> <a href="https://google.com" style="background-image:url('https://en.wikipedia.org/wiki/Main_Page#/media/File:BepiColombo_spacecraft_model.png'); display:block;">A Title</a> </h3> </li>

preferences:
38.67 ms | 463 KiB | 5 Q