Speed up development with full-stack environments for every branch.

Learn More

Check if a GMP number is a perfect square [PHP]

150 Runs 527 Views 142 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<?php
/*
 * PHP GMP -  Check if a GMP number is a perfect square
 */

// 3 * 3, perfect square
var_dump(gmp_perfect_square("9"));

// not a perfect square
var_dump(gmp_perfect_square("7"));

// 1234567890 * 1234567890, perfect square
var_dump(gmp_perfect_square("1524157875019052100"));

?>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).