3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Proof of Nonsense by Stephan Schmitz @ code.eyecatch-up.de // Complex and inefficient way of a php 'hello world' output function subval_sort($a,$subkey) { foreach($a as $k=>$v) { $b[$k] = strtolower($v[$subkey]); } asort($b); foreach($b as $key=>$val) { $c[] = $a[$key]; } return $c; } $a = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'); $p = array('4', '12', '18', '15', '23', '15', '12', '12', '5', '8'); $ls = ''; foreach ($p as $l){ $pa = $l - 1; $ls .= $a[$pa].'|'; } $ls = substr($ls, 0, -1); $ls = explode('|', $ls); $i = count($ls); $o = array(); foreach ($ls as $l){ $o[] = array( 'l' => $l, 'p' => $i ); $i = $i - 1; } $o = subval_sort($o,'p'); $ohw = ''; foreach ($o as $l){ $ohw .= $l['l']; } $oh = substr($ohw, 0, -5); $ow = strrev($ohw); $ow = substr($ow, 0, -5); $ow = strrev($ow); $oh = ucfirst($oh); $ow = ucfirst($ow); echo $oh; echo ' '; echo $ow;
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Hello World

preferences:
265.1 ms | 406 KiB | 311 Q