Found 1046 Articles for PHP

PHP rad2deg() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:17:17

119 Views

Definition and UsageMost trigonometric functions like sin, cos, tan etc require angle argument in radians. Whereas, in practice angle is represented in degrees. The rad2deg() function proves useful in conversion of radian angle to degrees.This function returns a float number such that number=rad2deg(x) where x is angle in radians. angle in radian = angle in deg *180/piFor example rad2deg(Π) is equal to 180 degreesSyntaxrad2deg ( float $number ) : floatParametersSr.NoParameter & Description1numberA float number reprsenting angle in radiansReturn ValuesPHP rad2deg() function returns a float number that represents angle in degrees.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x ... Read More

PHP pow() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:15:50

734 Views

Definition and UsageThe pow () function is used to compute power of a certain number. It returns xy calculation, also termed as x raised to y. PHP also provides "**" asexponentiation operator.So, pow(x, y) returns xy which is same as x**ySyntaxpow ( number $base , number $exp ) : numberParametersSr.NoParameter & Description1baseThe base to be raised2exppower to which base needs to be raisedReturn ValuesPHP pow() function returns base raised to power of exp. If both arguments are non-negative integers, the result is returned as integer, otherwise it is returned as a float.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x ... Read More

PHP pi() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:14:02

332 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

PHP octdec() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:12:30

60 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

PHP mt_srand() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:10:52

296 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

PHP mt_rand() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:13:01

317 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

PHP mt_getrandmax() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:06:54

112 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

PHP min() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:05:17

234 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

PHP max() Function

Malhar Lathkar
Updated on 29-Jun-2020 09:12:39

383 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

PHP log10() Function

Malhar Lathkar
Updated on 29-Jun-2020 09:10:34

101 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

Advertisements