Maximum number using max() function

MAX(value1,value2,value3....);
We can get maximum value or highest number between two variables or two numbers by using max function. We can use more than two numbers also. Here is the code.
<?Php
echo max(5,25,6,-22,-66); // Output is 25 
?>

Max with String

We can find out maximum by comparing one string wth a number. Here string will be treated as 0 and then compared.
<?Php
echo max(-2.5,'plus2net'); // Output  plus2net
echo max(0,'plus2net'); // Output is 0, when values are equal the order decides the output 
echo max(3,'plus2net');  //Output is 3
?>

Max with array

<?Php
echo max(array(3,15,-5)); //Output is 15
?>

Read More on max value of Array

Your Rating





Post your comments , suggestion , error , requirements etc here .




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer