Biggest int from array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Biggest int from array

Post by ol4pr0 »

I have been messing around to see how to get the largest value of an array. untill now i have not come with a solution.

Code: Select all

array("1","2","3");
$biggest = ?
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

sort()
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Found it .. :), altho i am up for better solutions

Code: Select all

$x = 6;
$y = max("5","6","7");
if ($y < $x) { 
	echo $x." is bigger"; 
	}
	else
	{
	echo $y ." is bigger"; 
}
Post Reply