Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

php
gmp_sign
communitycreator

What is gmp_sign in PHP?

Hammad Nasir

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

gmp_sign is a function in PHP which checks the sign of a GMP number.

Syntax


gmp_sign(GMP|int|string $num): int

Parameters

The function takes in one parameter num.


num can be a numeric string or GMP object.

Return value

  • The function returns 1 if num is positive.

  • The function returns -1 if num is negative.

  • The function returns 0 if num is 0.

Code

<?php
echo gmp_sign("550") . "\n";
echo gmp_sign("-700") . "\n";
echo gmp_sign("0") . "\n";
?>

Output


1
-1
0

RELATED TAGS

php
gmp_sign
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring