Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,907 questions

51,839 answers

573 users

How to find the highest value with max() in PHP

10 Answers

0 votes
echo max(23, 12, 33, 55, 41); 

/*
run: 

55

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max(0, 'aaa') . "<br />";
echo max('aaa', 0) . "<br />";
echo max('aaa', -1) . "<br />";
echo max(-1, 'aaa');

/*
run: 

0
aaa
aaa
aaa 

*/

 



answered Jul 4, 2016 by avibootz
0 votes
$arr = max('aaa', array(1, 2, 3), 1875);

echo "<pre>";
print_r($arr);
echo "</pre>";

/*
run: 

Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max(-2, FALSE);

/*
run: 

-2 

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max(FALSE, -2);

/*
run: 

-2 

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max(0, TRUE);

// 1 = TRUE

/*
run: 

1  

*/


 



answered Jul 4, 2016 by avibootz
0 votes
echo max(TRUE, 0);

// 1 = TRUE

/*
run: 

1  

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max('3abc', 1)

/*
run: 

3abc   

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max('-3abc', -1)

/*
run: 

-1    

*/

 



answered Jul 4, 2016 by avibootz
0 votes
echo max('a999', 4)

/*
run: 

4     

*/

 



answered Jul 4, 2016 by avibootz

Related questions

3 answers 255 views
1 answer 135 views
1 answer 153 views
1 answer 137 views
2 answers 174 views
2 answers 150 views
...