Description The cos() function calculates the cosine value of the number provided as its only parameter. The parameter should be passed as radians—you should use deg2rad() to convert degrees to radians. $cos1 = cos(10); $cos2 = cos(deg2rad(80)); Syntax: cos(float $num): float Parameters Parameter Description num An angle in radians Return Values Returns the cosine of […]
Archives for April 2022
PHP connection_status function – Returns connection status bitfield
Description The connection_status() function takes no parameters and returns 0 if the connection is live and execution is still taking place; 1 if the connection is aborted; 2 if the connection has been aborted; and 3 if the connection has been aborted and subsequently timed out. Syntax: connection_status(): int The values 0, 1, 2, and […]
PHP ceil function – Round fractions up
Description Returns an integer that is the next larger than the float used as the argument. In essence, it rounds up a floating-point number to an integer, no matter what the value of the floating-point integer is. It doesn’t round down. Syntax: ceil(int|float $num): float The ceil() function takes a floating-point number as its only […]
PHP bindec function – Convert a number between arbitrary bases
Description The bindec() function converts a binary number into a decimal number. It takes just one parameter, which is the number to convert. For example: print decbin(“10000”); // 16 Syntax: bindec(string $binary_string): int|float Up to a 32-bit number, or 2,147,483,647 decimal, can be converted. Parameters Parameter Description binary_string The binary string to convert. Any invalid […]
PHP base_convert function – Convert a number between arbitrary bases
Description Converts a number from one base to another. The base the number is currently in is from, and the base to convert to is to. The bases to convert from and to must be between 2 and 36. Digits in a base higher than 10 are represented with the letters a (10) through z […]
PHP atanh function – Inverse hyperbolic tangent
Description Returns the inverse hyperbolic tangent of value. Syntax: atanh(float $num): float Parameters Parameter Description y Dividend parameter x Divisor parameter Return Values Inverse hyperbolic tangent of num.
PHP atan2 function – Arc tangent of two variables
Description This function returns the value of the arctangent of the point denoted by the x and y parameters. The return value is in radians, in the range -pi to pi (approximately -3.14 to 3.14). It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are […]
PHP atan function – Arc tangent
Description The atan() function calculates the arc tangent value of the number provided as its only parameter, essentially reversing the operation of tan(). The return value is in radians—you should use the rad2deg() to convert radians to degrees. Syntax: asin(float $num): float Parameters Parameter Description num The argument to process. Return Values Returns the calculated […]
PHP asin function – Arc sine
Description The asin() function calculates the arc sine value of the number provided as its only parameter, essentially reversing the operation of sine(). The return value is in radians—you should use the rad2deg() to convert radians to degrees. $asin1 = asin(0.4346); $asin2 = asin(sin(80)); Syntax: asin(float $num): float Parameters Parameter Description num The argument to […]
PHP addslashes function – Quote string with slashes
Description There are many situations where single quotes (‘), double quotes (“), and backslashes (\) can cause problems—databases, files, and some protocols require that you escape them with \, making \’, \”, and \\ respectively. In these circumstances, you should use the addslashes() function, which takes a string as its only parameter and returns the […]