PHP Interview Questions and Answers

PHP Programming/ Logical Interview questions and answers

PHP Interview Questions with Answers
Written by Anuj kumar

Q 1. Write a program for this pattern ?

* * * * * 
* * * * 
* * * 
* * 
*

Answer –

Q2 -Write a program for this pattern ?

*
* *
* * *
* * * *
* * * * *

Answer-

Q3 -Write a program for this pattern ?

*
*  *
*  *  *
*  *  *  *
*  *  *  *  *
*  *  *  *  *  *
*  *  *  *  *
*  *  *  *
*  *  *
*  *
*

Answres-

Q4 -Write a program for this pattern ?

*****
*****
*****
*****
*****

Answer-

Q5- How to find a factorial of a number ?

Answer- 

Q 6- How to find whether a number prime or not ?

Answer-

Q 7- How to find whether a number armstrong or not ?

Answer- An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself.

For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.

Q 8- How to find  whether a year leap year or not ?

Answer-

Q9 -Write a program for this pattern(number pyramid) ?

1
22
333
4444
55555

Answer-

Q 10- How to print a number reverse ?

Answer –

Q11 – Swap two values without third variable ?

Answer –

About the author

Anuj kumar

I'm Anuj kumar a web developer with 4+ year experience .I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to is provide php , jquery , mysql , phpoops and other web development tutorials. I am trying best effort to make PHPGurukul useful for every single moment spend on this website. If you think this website is useful to visit please share with your friend and buddies.