- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1046 Articles for PHP
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
87 Views
Definition and UsageHere 1p stands for 1 plus. The log1p () function calculates natural (base-e) logarithm of a 1+number.log1p(x)=log(1+x).log1p is calculated in a way such that its value is accurate even for very small x such that 1+x is nearly equal to xSyntaxlog1p ( float $arg ) : floatParametersSr.NoParameter & Description1argThe number whose 1p logarithm is to be calculatedReturn ValuesPHP log1p() function returns base-1p logarithm of arg+1.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates log1p of 100OutputThis will produce following result −using log() to calculate log(1+100)=4.6151205168413 log1p(100)=4.6151205168413Example Live Demowhere normal log(0) returns ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
204 Views
Definition and UsageThe log () function calculates natural logarithm of a number.Logarithm is inverse of eponential. If 102=100, it means log10100=2. Natural logarithm is calculated with Euler Number e as base. In PHP, the predefined constant M_E gives value of e which is 2.7182818284590452354For example, exp(4.60517018599)=100 (it is also same as e4.60517018599=100). Hence, loge100=4.60517018599In PHP, loge is represented by log() functionSyntaxlog ( float $arg [, float $base = M_E ] ) : float ParametersSr.NoParameter & Description1argThe value whose logarithm is to be calculated2baseDefault value of base is M_E.Return ValuesPHP log() function returns logarithm of arg to base. If base is not given, result is ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
97 Views
Definition and UsageThe lcg_value() function generates a random number between 0 and 1.LCG stands for linear congruential generator. This generator generates a sequence of pseudo-randomized numbers calculated with a discontinuous piecewise linear equation. This is one of the oldest pseudorandom number generator algorithmsSyntaxlcg_value ( void ) : floatParametersReturn ValuesPHP lcg_value() function returns a pseudo random float value between 0.0 and 1.0, inclusive.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing is the example use of lcg_value() function −OutputThis may produce following result −lcg_value() = 0.45920201711279 lcg_value() = 0.18118693614628
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
722 Views
Definition and UsageNAN stands for "Not A Number". The is_nan() function checks whether its argument is not a number.Syntaxis_nan ( float $val ) : bool ParametersSr.NoParameter & Description1valThe value to be verified if infinite or notReturn ValuesPHP is_nan() function returns TRUE if val is "not a number", otherwise it returns FALSE.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that 100 qualifies as NANOutputThis will produce following result −int(100) bool(false)Example Live DemoValue of log(0) is infinity. Following example verifies if it is NAN −OutputThis will produce following result −float(-INF) bool(false)Example Live DemoSince cos(x) ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
197 Views
Definition and UsageThe is_infinite() function returns a boolean value. It checks whether given parameter is an infinnite number and if so the function returns TRUE, otherwise FALSE. A number is treated as infinite if it is beyond acceptable range of float in PHP.Syntaxis_infinite ( float $val ) : bool ParametersSr.NoParameter & Description1valThe value to be verified if infinite or notReturn ValuesPHP is_infinite() function returns TRUE if val is outside accepted range of float, otherwise it returns FALSE.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that 100 is not an ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
72 Views
Definition and UsageThe is_finite() function returns a boolean value. It checks whether given parameter is a legal finite number and if so the function returns TRUE, otherwise FALSESyntaxis_finite ( float $val ) : bool ParametersSr.NoParameter & Description1valThe value to be verified if finite or notReturn ValuesPHP is_finite() function returns TRUE if val is within accepted range of float, otherwise it returns FALSE.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example shows that 100 is a finite numberOutputThis will produce following result −100 is a finite numberExample Live DemoValue of log(0) is undefined. ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
56 Views
Definition and UsageThe intdiv() function returns integer quotient of two integer parameters. If x/y results in i as division and r as remainder so thatx = y*i+r In this case, intdiv(x, y) returns i Syntaxintdiv ( int $x , int $y ) : int ParametersSr.NoParameter & Description1xThis parameter forms numerator part of division expression2yThis parameter forms denominator part of division expressionReturn ValuesPHP intdiv() function returns integer quotient of division of x by y. The return value is positive if both parameters are positive or both parameters are negative.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
108 Views
Definition and UsageThe hypot() function calculates length of hypotenus of a right angled triangle. Hypoteneuse is calculated as per following formula −h=sqrt(x2+y2) where x and y are other two sides of a right angled triangleFor example, if x=3 and y=4, hypot(x, y)=5 which is equal to sqrt(32+42) = sqrt(25) =5This function always returns a float.Syntaxhypot ( float $x , float $y ) : floatParametersSr.NoParameter & Description1xone side of right angled triangle2yother side of right angled triangleReturn ValuesPHP hypot() function returns length of hypotenuse of a right angled triangle with given values of x and yPHP VersionThis function is available in ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
51 Views
Definition and UsageThe hexdec() function returns a decimal number equivalent of a hexadecimal number embedded in a string.This function returns a a decimal integer, though larger values may result in floats.Syntaxhexdec ( string $hex_string ) : numberParametersSr.NoParameter & Description1hex_stringA decimal number to be converted in equivalent octal representationReturn ValuesPHP hexdec() function returns a decimal number.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates decimal equivalent of '100' and returns 256 −OutputThis will produce following result −hexdec(100) = 256Example Live DemoIf the string contains invalid characters (other than 0-9 and a-f) they ... Read More
![Malhar Lathkar](https://www.tutorialspoint.com/assets/profiles/211197/profile/60_4699-1591856239.jpg)
132 Views
Definition and UsageThe getrandmax() function returns largest integer that can be used in PHP. Value returned by this function serves as the upper limit for rand() function to generate random number.This function always returns an integer.Syntaxgetrandmax ( void ) : intParametersSr.NoParameter & Description1This function needs no parametersReturn ValuesPHP getrandmax() function returns largest possible integer that can be used in PHP. On 64 bit Windows, the number is 2147483647PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example returns largest possible integer−OutputThis may produce following result (it being a random number, it is ... Read More