Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 1740 of 2650
210 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
917 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
282 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
148 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
74 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
186 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
133 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
210 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
253 Views
Definition and UsageThe name fmod stands for floating modulo . This function returns remainder of division of two floating point numbers. If x/y results in i as division and r as remainder so thatx = y*i+r In this case, fmod(x, y) returns rSyntaxfmod ( float $x , float $y ) : float ParametersSr.NoParameter & Description1xThis parameter forms numerator part of division expression2yThis parameter forms denominator part of division expressionReturn ValuesPHP fmod() function returns floating point remainder of the act of division of x by y. Remainder carries sign of x.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as ... Read More
771 Views
Definition and UsageThe floor() function is another in-built function in PHP iterpreter. This function accepts any float number as argument and rounds it down to the next lowest integer.This function always returns a float number as range of float is bigger than that of integer.Syntaxfloor ( float $num ) : floatParametersSr.NoParameter & Description1numThe number to be rounded down.Return ValuesPHP floor() function returns the largest integer less than or equal to given parameter.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example rounds 15.05 to its next highest integer which is 15OutputThis will ... Read More