Input
Output
<?php // Define a two-digit number $number = 47; // Check if it's a valid two-digit number if ($number >= 10 && $number <= 99) { $firstDigit = (int)($number / 10); // Get the tens digit $secondDigit = $number % 10; // Get the ones digit $sum = $firstDigit + $secondDigit; echo "The sum of digits of $number is: $sum"; } else { echo "Please enter a valid two-digit number."; } ?>