Skip to content

Instantly share code, notes, and snippets.

@donjajo
Created April 4, 2019 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donjajo/85d4887c408389402df511e4081282ba to your computer and use it in GitHub Desktop.
Save donjajo/85d4887c408389402df511e4081282ba to your computer and use it in GitHub Desktop.
<?php
$numbers = [ 3,3,2,2,56,4,4 ];
$checked = [];
foreach( $numbers as $number ) {
$checked[ $number ] = !empty( $checked[ $number ] ) ? $checked[ $number ] + 1 : 1;
}
asort( $checked );
echo current( array_keys( $checked ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment