3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ratingHistory = [ "BB", "B", "CCC", "C", "BB" ]; function getMinMax($array): array { $result = ['min' => null, 'max' => null]; foreach ($array as $value) { if ( !$result['min'] || (!trim($value, $result['min']) ? $value < $result['min'] : $value > $result['min']) ) { $result['min'] = $value; } if ( !$result['max'] || (!trim($value, $result['max']) ? $value > $result['max'] : $value < $result['max']) ) { $result['max'] = $value; } } return $result; } var_export(getMinMax($ratingHistory));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'min' => 'C', 'max' => 'BB', )

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:
54.38 ms | 401 KiB | 8 Q