Challenge 2: Square of Sum of Numbers

Test your knowledge by writing code to compute the square of sum of two numbers.

Problem statement

Write a PHP function sum_square() that squares the sum of two integers. The function should take two integers as parameters, add them, and then return the square of the result.

Sample input 1

num1 = 1
num2 = 2

Expected output

9

Sample input 2

num1 = 7
num2 = 5

Expected output

144

Try it yourself

Get hands-on with 1200+ tech skills courses.