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 1739 of 2650
455 Views
Definition and UsageThe pi () function returns the value of mathematical constant Π. It returns a float value 3.14159265359 which is equal to predefined constant defined in PHP - M_PISyntaxpi ( void ) : floatParametersThis function requires no parametersReturn ValuesPHP pi() function returnsthe mathematical constant Π and is equal to predefined mathematical constant M-PI. Instead of using M_PI, we can use pi() function in mathematical expressions.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing exampleuses pi() function in calculation of area of circle.OutputThis will produce following result −area of circle with radius = 5is ... Read More
128 Views
Definition and UsageThe octdec() function is used to convert an octal number to decimal number equivalent. The function takes a string with octal representation as argument and retuns an integer.For example octdec('10') returns 8.Syntaxoctdec ( string $octal_string ) : numberParametersSr.NoParameter & Description1octal_stringA string containing the octal number to be convertedReturn ValuesPHP octdec() function returns a decimal equivalent of given octal representation.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example converts '10' from octal to decimal number system. −OutputThis will produce following result −octdec(10) = 8Example Live DemoIf there is Any character other ... Read More
431 Views
Definition and UsagePrefix 'mt' in function's name stands for Mersenne Twister. The mt_srand() function is used to seed the Mersenne Twister random number generaror. Seeding initializes the random number generator. Most random number generators need initial seeding. In PHP, use of mt_srand() function is optional as it is done automatically.This function doen't have any return value.Syntaxmt_srand ([ int $seed [, int $mode = MT_RAND_MT19937 ]] ) : voidParametersSr.NoParameter & Description1seedan integer to be used as seed. If not given, a random number is given2modeUse one of the following constants to specify mode of implementationMT_RAND_MT19937 uses fixed Mersenne Twister implementationMT_RAND_PHP uses ... Read More
427 Views
Definition and UsageThe 'mt' prefix in function's name stands for Mersenne Twister. The mt_rand() function returns an integer using Mersenne Twister Random Number Generator method. This function is a drop-in replacement for PHP's rand() function. default range is between 0 and platform specific mt_getrandmax(). On 64 bit Windows OS, it is 2147483647. The mt_rand() function can be called without arguments (in which case the default range will be used) or by specifying min and max parameters.This function always returns an integer.Syntaxmt_rand ( void ) : int mt_rand ( int $min , int $max ) : intParametersSr.NoParameter & Description1minlower limit of ... Read More
171 Views
Definition and UsageThe 'mt' prefix in function's name stands for Mersenne Twister. The mt_ getrandmax() function returns largest integer that can be used in PHP. This function uses Mersenne Twister Random Number Generator method. Value returned by this function serves as the upper limit for mt_rand() function to generate random number.This function always returns an integer.Syntaxmt_getrandmax ( void ) : intParametersSr.NoParameter & Description1This function needs no parametersReturn ValuesPHP mt_getrandmax() function use Mersenne Twister Random Number Generator method. and returns largest possible integer that can be used in PHP. On 64 bit Windows, the number is 2147483647PHP VersionThis function is available ... Read More
350 Views
Definition and UsageThe min () function returns lowest element in array, or lowest amongst two or more comma separated parameters.Syntaxmin ( array $values ) : mixedOrmin ( mixed $value1 [, mixed $... ] ) : mixedParametersSr.NoParameter & Description1valuesIf only one parameter is given, it should be an array of valaues which may be of same or different types2value1, value2, ..If two or more parameters aregiven, they should be any comparable values of same or different typesReturn ValuesPHP min() function returns lowest value from the array parameter or sequence of values. Standard comparison operators are applicable. If multiple values of different types evaluate ... Read More
566 Views
Definition and UsageThe max () function returns highest element in array, or highest amongst two or more comma separated parameters.Syntaxmax ( array $values ) : mixedOrmax ( mixed $value1 [, mixed $... ] ) : mixedParametersSr.NoParameter & Description1valuesIf only one parameter is given, it should be an array of valaues which may be of same or different types2value1, value2, ..If two or more parameters aregiven, they should be any comparable values of same or different typesReturn ValuesPHP max() function returns highest value from the array parameter or sequence of values. Standard comparison operators are applicable. If multiple values of different types evaluate ... Read More
200 Views
Definition and UsageThe log10 () function calculates base-10 logarithm of a number.Base-10 logarithm is also called common or sandard algorithm. The log10(x) function calculates log10x. It is related to natural algorithm by following equation −log10x=logex/loge10 So thatlog10100=loge100/loge10 = 2In PHP, log10 is represented by log10() functionSyntaxlog10 ( float $arg ) : floatParametersSr.NoParameter & Description1argThe number whose base-10 logarithm is to be calculatedReturn ValuesPHP log10() function returns base-10 logarithm of arg.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculates base-10 logarithm of 100OutputThis will produce following result −log10(100)=2Example Live DemoFollowing code calculates base-10 logarithm of ... Read More
156 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
319 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