Server Side Programming Articles - Page 1738 of 2650

PHP tanh() Function

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

156 Views

Definition and UsageThe tanh() function returns the hyperbolic tangent ratio of given angle in radians. In trigonometry, hyperbolic tangent ratio is defined as.tanh(x) = sinh()/tanh()This function returns a float value .Syntaxtanh ( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point value that represents angle in radiansReturn ValuesPHP tanh() function returns hyperbolic tangent 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 tanh(pi/2) and returns 2.5091784786581 which is also the result of formula (ex + e-x))/2 −OutputThis will produce following result −tanh(pi) = 0.91715233566727 using formula = 0.91715233566727Example Live DemoFollowing example uses deg2rad() ... Read More

PHP tan() Function

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

171 Views

Definition and UsageThe tan() function returns the tangent ratio of given angle in radians. In trigonometry, tangent of an angle is defined as ratio of lengths of opposite side and adjacent side.tan(x) = opposite/adjacenttangent of an angle is also defined as ratio of its sine and cosinetan(x) = sin(x)/cos(x)If x=45 degree, tan(x) = 1 as in a right angled traingle, opposite and adjacent sides are qual.This function returns a float value.Syntaxtan ( float $arg ) : floatParametersSr.NoParameter & Description1argA floating point value that represents angle in radiansReturn ValuesPHP tan() function returns tangent ratio of given parameter.PHP VersionThis function is available in PHP versions 4.x, PHP ... Read More

PHP srand() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:29:27

349 Views

Definition and UsageThe srand() function is used to seed the random number generaror. Seeding initializes the random number generator. Most random number generators need initial seeding. In PHP, use of srand() function is optional as it is done automatically.This function doen't have any return value.Syntaxsrand ([ int $seed ] ) : voidParametersSr.NoParameter & Description1seedan integer to be used as seed. If not given, a random number is givenReturn ValuesThis function doesn't return any value.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoThis example the random number generator is first initialized before employing ... Read More

PHP sqrt() Function

Malhar Lathkar
Updated on 30-Jun-2020 07:27:34

2K+ Views

Definition and UsageThe sqrt() function returns square root of a positive float number. Since square root for negative number is not defined, it returns NAN. This is one of the most commonly used functions.This function always returns a floating point number.Syntaxsqrt ( float $arg ) : floatParametersSr.NoParameter & Description1arga number whose square root is to be obtainedReturn ValuesPHP sqrt() function returns square root of the given arg number. For negative number, the function returns NAN.PHP VersionThis function is available in PHP versions 4.x, PHP 5.x as well as PHP 7.x.Example Live DemoFollowing example calculate square root of 100−OutputThis will produce following ... Read More

PHP sinh() Function

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

150 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

255 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

974 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

347 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

199 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

Advertisements