3v4l.org

run code in 300+ PHP versions simultaneously
<?php $session = <<<TEXT # Session range - Number of visits BEGIN_SESSION 7 1h+ 10 5mn-15mn 9 0s-30s 107 2mn-5mn 7 30s-2mn 21 15mn-30mn 4 30mn-1h 11 END_SESSION TEXT; $newline = "\n"; $lines = explode($newline, $session); $results = []; foreach ($lines as $line) { if (sscanf($line, '%d%1s%s %d', $time, $unit, $tail, $count) === 4) { $times[] = $time; $units[] = $unit; $result[] = ["$time$unit$tail", $count]; } } array_multisort($units, $times, SORT_DESC, $result); var_export($result);
Output for git.master_jit, git.master
array ( 0 => array ( 0 => '1h+', 1 => 10, ), 1 => array ( 0 => '30mn-1h', 1 => 11, ), 2 => array ( 0 => '15mn-30mn', 1 => 4, ), 3 => array ( 0 => '5mn-15mn', 1 => 9, ), 4 => array ( 0 => '2mn-5mn', 1 => 7, ), 5 => array ( 0 => '30s-2mn', 1 => 21, ), 6 => array ( 0 => '0s-30s', 1 => 107, ), )

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:
55.56 ms | 406 KiB | 5 Q