Found 1060 Articles for PHP

PHP sinh() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:25:47

140 Views

Definition and UsageThe sinh() function calculates hyperbolic sine of given angle in radians. A hyperbolic sine function is defined assinh(x) = (ex – e-x))/2This function returns a float value between Π and -Π.Syntaxsinh( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point value that represents angle in radiansReturn ValuesPHP sinh() function returns hyperbolic sine ratio of 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 calculates sinh(pi/2) and returns 2.3012989023073 which is also the result of formula (ex – e-x))/2−OutputThis will produce following result −sinh(M_PI_2) = 2.3012989023073 using formula = ... Read More

PHP sin() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:23:38

244 Views

Definition and UsageThe sin() function returns the sine ratio of given angle in radians. In trigonometry, sine of an angle is defined as ratio of lengths of opposite side and hypotenuse.sin(x) = opposite/hypotenuseIf x=90 degree, sin(x) = 1 as opposite side of right angle is a hypotenuseThis function returns a float value.Syntaxsin ( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point value that represents angle in radiansReturn ValuesPHP sin() function returns sine ratio of 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 calculates sin(pi/2) and returns 1. Sine ratio of 90 deg is ... Read More

PHP round() Function

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

958 Views

Definition and UsageThe round() function proves useful in rounding any floating point number upto a desired precision level. Positive precision parameter causes the number to be rounded after decimal point, whereas with negative precision, rounding occurs before decimal point. Precision is 0 by default.For example, round(10.6) returns 11, round(10.2) returns 10. The function always returns a floating point number.This function also has another optional parameter called mode takes one of the redefined constants described later.Syntaxround ( float $value , int $precision , int $mode ) : floatParametersSr.NoParameter & Description1valueA float number to be rounded2precisionnumber of decimal digits to round to. ... Read More

PHP rand() Function

Malhar Lathkar
Updated on 30-Jun-2020 08:29:10

330 Views

Definition and UsageThe rand() function returns an integer using pseudo random genaration technique. default range is between 0 and platform specific getrandmax(). On 64 bit Windows OS, it is 2147483647. The 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.Syntaxrand ( void ) : int rand ( int $min , int $max ) : intParametersSr.NoParameter & Description1minlower limit of range to return a number from. Default is 02maxUpper limit of range to return a number from. Default is getrandmax()Return ValuesPHP rand() ... Read More

PHP rad2deg() Function

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

187 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

1K+ 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

435 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

119 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

416 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

414 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

Advertisements