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;

preferences:
42.5 ms | 402 KiB | 5 Q