1.

Common PHP function with code

Answer»

Common PHP function with code
Below are the diferent PHP function with example and output
(1)is_number
it is used to check value is numeric or not
Code:-
< ?php
if(is_numeric("crackyourinterview"))
{
echo "true";
}
else
{
echo "false";
}
?>
Output:-False

(2)number_format
used to separate digit and decimal parts
Code
< ?php
echo number_format(1124563);
? >
Output:-1,124,563

(3)rand
Used to generate a random NUMBER
Code:-
< ?php
echo rand();
?>
Output:- Random Number

(4)round
Round off a number with decimal points to NEAREST WHOLE number
Code:-
< ?php
echo round(56.23);
?>
Output:-56

(5)SQRT
Return the square root of a number
Code:-
< ?php
echo sqrt(81);
?>
Output:-9

(5)cos
Return the cosine
Code:-
echo cos(45);
?>
Output:-0.52532198881773

(6)sin
Return the sine
Code:-
< ?php
echo sin(45);
?>
Output:-0.85090352453412

(7)tab
Return the tangent
Code:-
< ?php
echo TAN(45);
?>
Output:-1.6197751905439

(8)pi
Returns the value of PI
Code:-
< ?php
echo pi();
?>
Output:-3.1415926535898



Discussion

No Comment Found