1) abs
Return the absolute value of different numbers:
Example:
echo abs(-4)."<br>";
echo abs(-5.3)."<br>";
echo abs(2)."<br>";
Output:
4
5.3
2
2) arsort
Sort an array in reverse order and maintain index association
Example:
$name=array('c'=>"cat",'a'=>"apple",'b'=>"ball");
arsort($name);
foreach ($name as $k=>$v)
{
echo "$k=>$v<br>";
}
Output:
c=>cat
b=>ball
a=>apple
3) asort
Sort an array and maintain index association
Example:
$name=array('c'=>"cat",'a'=>"apple",'b'=>"ball");
asort($name);
foreach ($name as $k=>$v)
{
echo "$k=>$v<br>";
}
Output:
a=>apple
b=>ball
c=>cat
4) ceil
Round numbers up to the nearest integer
Example:
echo ceil(4.3)."<br>";
echo ceil(4.5)."<br>";
echo ceil(4.7)."<br>";
echo ceil(-4.3)."<br>";
echo ceil(-4.5)."<br>";
echo ceil(-4.7)."<br>";
Output:
5
5
5
-4
-4
-4
Return the absolute value of different numbers:
Example:
echo abs(-4)."<br>";
echo abs(-5.3)."<br>";
echo abs(2)."<br>";
Output:
4
5.3
2
2) arsort
Sort an array in reverse order and maintain index association
Example:
$name=array('c'=>"cat",'a'=>"apple",'b'=>"ball");
arsort($name);
foreach ($name as $k=>$v)
{
echo "$k=>$v<br>";
}
Output:
c=>cat
b=>ball
a=>apple
3) asort
Sort an array and maintain index association
Example:
$name=array('c'=>"cat",'a'=>"apple",'b'=>"ball");
asort($name);
foreach ($name as $k=>$v)
{
echo "$k=>$v<br>";
}
Output:
a=>apple
b=>ball
c=>cat
4) ceil
Round numbers up to the nearest integer
Example:
echo ceil(4.3)."<br>";
echo ceil(4.5)."<br>";
echo ceil(4.7)."<br>";
echo ceil(-4.3)."<br>";
echo ceil(-4.5)."<br>";
echo ceil(-4.7)."<br>";
Output:
5
5
5
-4
-4
-4