3v4l.org

run code in 300+ PHP versions simultaneously
<?php // $result = $conn->query("SELECT content, sub_content FROM objectives"); $result = [ ["content" => "Demonstrate where to find the following documentation:", "sub_content" => "Operating and Safety Strategy"], ["content" => "Explain the different turbine main operating states:", "sub_content" => "0"], ["content" => "Explain the different turbine main operating states:", "sub_content" => "Power Production"], ["content" => "Explain the different turbine main operating states:", "sub_content" => "Idle"], ["content" => "Explain the different turbine main operating states:", "sub_content" => "Stop"], ["content" => "Explain how to recognise the current operating mode on the display of the operating panel", "sub_content" => "0"], ["content" => "Explain the subsystem operating modes:", "sub_content" => "Stop"], ["content" => "Explain the subsystem operating modes:", "sub_content" => "Manual"], ["content" => "Explain the subsystem operating modes:", "sub_content" => "0"], ["content" => "Explain the difference between local and remote point of operation", "sub_content" => "0"], ["content" => "Explain that only one point of operation can be active at a time", "sub_content" => "0"] ]; $categories = array(); foreach ($result as $result) { $category = $result['content']; $categories[$category][] = $result['sub_content']; } echo "<ul>\n"; foreach ($categories as $category => $subcategories): echo "\t<li>"; echo $category; echo "\n\t\t<ul>\n"; foreach ($subcategories as $subcategory): if ($subcategory !== '0') { echo "\t\t\t<li>$subcategory</li>\n"; } endforeach; echo "\t\t</ul>\n"; echo "\t</li>\n"; endforeach; echo "</ul>";
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
<ul> <li>Demonstrate where to find the following documentation: <ul> <li>Operating and Safety Strategy</li> </ul> </li> <li>Explain the different turbine main operating states: <ul> <li>Power Production</li> <li>Idle</li> <li>Stop</li> </ul> </li> <li>Explain how to recognise the current operating mode on the display of the operating panel <ul> </ul> </li> <li>Explain the subsystem operating modes: <ul> <li>Stop</li> <li>Manual</li> </ul> </li> <li>Explain the difference between local and remote point of operation <ul> </ul> </li> <li>Explain that only one point of operation can be active at a time <ul> </ul> </li> </ul>
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
158.11 ms | 408 KiB | 5 Q