An Armstrong number is sum of the cubes of its digits is equal to the number itself. There are six Armstrong numbers in the range of 0 and 999. Armstrong number 1: 0 Armstrong number 2: 1 Armstrong number 3: 153 Armstrong number 4: 370 Armstrong number 5: 371 Armstrong number 6: 407 PHP Program […]

Comment: 0 Publish Date: 07/05/2018

Here we are writing a program of print the factorial of a number, factorial means 1 to n multiply them where n is defined by the product of all the digits from 1 to n. Important Points About Factorial: 1. Factorial is denoted by n!. 2. Factorial is calculated only for positive integers(9) not for […]

Here we are write a PHP program to print table of given number, A table of a number can be printed using a loop. Logical Part of program: 1. First you have to take a number. 2. Then run the for loop 3. Then Multiply the number with output of for loop (). PHP program […]

Here we are write a program to find number is prime or not of a given number, Prime number which is only divisible by 1 and itself. Example of Prime Numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23 etc. Prime number greater than 1 means 0 and 1 is not a prime number. […]

Here we are write a program to find number is Even or Odd of a given number, for find the Even Odd we have to divide given number by 2. Odd Numbers : Odd numbers are those numbers which are not divisible by 2. Numbers Like 1, 3, 5, 7, 9, 11, 13, 15, 17, […]

Here we are write a program to find sum of digits of a given number, for the sum of digits we have to add all the digits of given number. Logical Part of program: 1. First you have to take the number. 2. Then divide the taken number by 10. 3. Store the remainder into […]

Some time ago during a job interview I got the task to Delete an element from an array in php. Is there an easy way to delete an element from a PHP array, If you want to delete just one array element you can use unset() or alternative array_splice(). <?php $array = array(0 => “a”, […]

Some time ago during a job interview I got the task to print a string in reverse order in PHP. Here i am writing program for print string in revers order using strrev() function. <?php $str = ‘This is string Print In Revers Order’; echo strrev(str); ?> Print string in revers order without using strrev() […]

PHP Functions For Sorting Array In Descending Order: rsort(). The rsort() function sorts an indexed array in descending order. Sort the elements of the $MyArray array in descending numerical order: <?php $MyArray=array(8, 20, 4, 100, 50, 6, 9, 11, 22, 5); rsort($MyArray); print_r($MyArray); ?> Output: Array ( [0] => 100 [1] => […]