Reverse number10 Mar 2025 | 1 min read A number can be written in reverse order. For example 12345 = 54321 Logic:
Reversing Number in PHPExample: Below progrem shows digits reversal of 23456. ExampleExecute NowOutput: ![]() Reversing Number With strrev () in PHPExample: Function strrev() can also be used to reverse the digits of 23456. ExampleExecute NowOutput:/strong> ![]() Next TopicReverse String |
Reverse String A string can be reversed either using strrev() function or simple PHP code. For example, on reversing JAVATPOINT it will become TNIOPTAVAJ. Logic: Assign the string to a variable. Calculate length of the string. Declare variable to hold reverse string. Run for loop. Concatenate string inside for loop. Display reversed string. Reverse String...
1 min read
Tutorial Compiler Programs OOPs Functions Interview Questions | PHP Programming Examples PHP programs are frequently asked in the interview. These programs can be asked from basics, control statements, array, string, oops,...
2 min read
Area of Triangle Area of a triangle is calculated by the following Mathematical formula, (base * height) / 2 = Area Area of Triangle in PHP Program to calculate area of triangle with base as 10 and height as 15 is shown. Example: Example <?php $base = 10; $height = 15; echo...
1 min read
Prime Number A number which is only divisible by 1 and itself is called prime number. Numbers 2, 3, 5, 7, 11, 13, 17, etc. are prime numbers. 2 is the only even prime number. It is a natural number greater than 1 and so 0 and 1...
1 min read
Palindrome Number A palindrome number is a number which remains same when its digits are reversed. For example, number 24142 is a palindrome number. On reversing it we?ll get the same number. Logic: Take a number. Reverse the input number. Compare the two numbers. If equal, it means number is palindrome Palindrome Number...
1 min read
Factorial Program The factorial of a number n is defined by the product of all the digits from 1 to n (including 1 and n). For example, 4! = 4*3*2*1 = 24 6! = 6*5*4*3*2*1 = 720 Note: It is denoted by n! and is calculated only for positive integers. Factorial of...
2 min read
Subtracting Two Numbers There are three methods to subtract two numbers: Subtraction in simple code in PHP Subtraction in form in PHP Subtraction without using arithmetic operator (+). Subtraction in Simple Code Subtraction of two numbers 30 and 15 is shown. Example: Example <?php $x=30; $y=15; $z=$x-$y; echo "Difference: ",$z; ?> Execute Now Output: Subtraction in Form By inserting values in the form...
1 min read
Table of Number A table of a number can be printed using a loop in program. Logic: Define the number. Run for loop. Multiply the number with for loop output. Example: We'll print the table of 7. Example <?php define('a', 7); for($i=1; $i<=10; $i++) { echo $i*a; echo '<br>';...
1 min read
Swapping two numbers Two numbers can be swapped or interchanged. It means first number will become second and second number will become first. For example a = 20, b = 30 After swapping, a = 30, b = 20 There are two methods for swapping: By using third variable. Without using third variable. Swapping...
1 min read
Area of a Rectangle Area of a rectangle is calculated by the mathematical formula, Length ∗ Breadth = Area Logic: Take two variables. Multiply both of them. Area of Rectangle in PHP Program to calculate area of rectangle with length as 14 and width as 12 is shown. Example: Example <?php $length = 14; $width...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India