Found 1060 Articles for PHP

rand() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 07:03:56

220 Views

The rand() function gets a random number. You can also set a range to get random number from that particular range.Syntaxrand(); or rand(min_range,max_range);Parametersmin_range − Default is 0. This is the lowest number to be Returned.max_range − This is the highest number to be Returned.ReturnThe rand() function Returns a random integer between min_range and max_range.Example Live DemoOutput158122727010940012273063370521512118877894804115835633ExampleLet us see another example − Live DemoOutput4114

rad2deg() function in PHP

Samual Sam
Updated on 27-Dec-2019 07:02:47

77 Views

The rad2deg() function converts radian value to degree value. It Returns the equivalent of radia value val in degrees.Syntaxrad2deg(val)Parametersval − The radian value to be converted into degree.ReturnThe rad2deg() function Returns the equivalent of val in degrees.Example Live DemoOutput180ExampleLet us see another example − Live DemoOutput90ExampleLet us see another example − Live DemoOutput22.5

pow() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 07:01:25

211 Views

The pow() function Returns a raised to the power of b.Syntaxpow(a,b)Parametersa − The baseb − The exponentReturnThe pow() function Returns a raised to the power of b.Example Live DemoOutput243ExampleLet us see another example − Live DemoOutput4096-5.0805263425291E-5ExampleLet us see another example − Live DemoOutputNAN

pi() function in PHP

Samual Sam
Updated on 27-Dec-2019 06:57:57

133 Views

The pi() function Returns the value of Pi (π).Syntaxpi()ParametersNAReturnThe pi() function Returns the approximate value of PI. This value is a floating point value.3.1415926535898Example Live DemoOutput3.1415926535898ExampleLet us see another example to get the value of PI Live DemoOutput3.1415926535898

octdec() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 06:57:16

71 Views

The octdec() function converts octal to decimal.Syntaxoctdec(val)Parametersval − the octal string to convertReturnThe octdec() function Returns the decimal equivalent of the specified octal number.Example Live DemoOutputa80ExampleLet us see another example − Live DemoOutput120170

mt_srand() function in PHP

Samual Sam
Updated on 26-Jun-2020 09:49:42

87 Views

The mt_srand() function seeds the Mersenne Twister random number generator.Note − Random number generator is seeded automatically after the release of PHP 4.2.0. This function is not needed now.Syntaxmt_srand(seed)Parametersseed − The seed valueReturnThe mt_srand() function Returns nothing.Example Live DemoOutput1320295657

mt_rand() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 06:56:17

101 Views

The mt_rand() function is used to generate random numbers. The numbers are generated using the Mersenne Twister algorithm.Note − This function is faster than the rand() functionSyntaxmt_rand() or mt_rand(min, max)Parametersmin − Default is 0.The lowest number to be Returned.max − The highest number to be Returned.ReturnThe mt_rand() function Returns a random integer between min (or 0) and max. FALSE is Returned if max < min.Example Live DemoOutput144ExampleLet us see another example − Live DemoOutput132850920

mt_getrandmax() function in PHP

Samual Sam
Updated on 26-Jun-2020 09:50:15

61 Views

The mt_getrandmax() function Returns the largest possible random value.Syntaxmt_getrandmax()ParametersNAReturnThe mt_getrandmax() function Returns an integer value, which is the largest possible random value.Example Live DemoOutput2147483647

min() function in PHP

karthikeya Boyini
Updated on 27-Dec-2019 06:55:31

128 Views

The min() function Returns the minimum value of an array.Syntaxmin(arr_values); or min(val1,val2,...);Parametersarr_values − The array with values.val1, val2 − The values to compare.ReturnThe min() function Returns the minimum value of an array.Example Live DemoOutput12ExampleLet us see another example − Live DemoOutput12

max() function in PHP

Samual Sam
Updated on 27-Dec-2019 06:53:28

159 Views

The max() function Returns the maximum value of an array.Syntaxmax(arr_values); or max(val1,val2,...);Parametersarr_values − The array with values.val1, val2 − The values to compare.ReturnThe max() function Returns the maximum value of an array.Example Live DemoOutput89ExampleLet us see another example − Live DemoOutput89

Advertisements