# 4K

Php Software Developer interview questions shared by candidates

## Top Interview Questions

Sort: Relevance|Popular|Date
PHP Developer was asked...September 11, 2016

### Q1. Draw star pattern like. n=1. * n=2. ** * n=3. *** ** * n=4 **** *** ** * n=5. ***** **** *** ** *

int main() { int i,j,s,n; scanf("%d",&amp;n); for(i=1;i&lt;=n;i++) { for(s=1;s&lt;=n-i;s++) { printf(" "); } for(j=1;j&lt;=(n+1)-i;j++) { printf("*"); } printf("\n"); } } Less

x=int(input()) for i in range(x,0,-1): for k in range(i-1,0,-1): print(" ",end="") for j in range(i,0,-1): print("*",end="") print() Less

#include int main() { // Input n from user and make h,s,n all equal // Input 5 is taken randomly it can be any thing int h = 5; int n = 5; int s ; s=n; for(int u = 0; u 0 ; s-- ) { printf(" "); } for(int s = h ; h&gt;0 ; s-- ) { printf("*"); h--; } printf("\n"); h = n - 1; } Less

### Given an array of numbers [1,3,3,5,9,4,1,10,9,7,2,7], Write a php function that will print numbers that are not duplicated in array. [5,4,10,2]

The simplest solution for me is to loop through array, unset the current value then check if it is in the array which mean its duplicate and we add it to duplicated values array, if not ,its unique and added to another array for unique numbers .. in every iteration we check the number in the main array and in the duplicated array .. finally we print the unique array. Less

\$firstarray = [1,3,3,5,9,4,1,10,9,7,2,7]; \$secondarray = []; foreach (\$firstarray as \$i) { if (array_key_exists(\$i, \$secondarray)) { \$secondarray[\$i] += 1; } else { \$secondarray[\$i] = 1; } } \$result = []; foreach (\$secondarray as \$i=&gt;\$j) { if (\$j==1) { array_push(\$result, \$i); } } echo var_dump(\$firstarray); echo "<br>"; echo var_dump(\$result); Less

\$firstarray = [1,3,3,5,9,4,1,10,9,7,2,7]; \$secondarray = []; foreach (array_count_values(\$firstarray) as \$i=&gt;\$j) { if (\$j==1) { array_push(\$secondarray, \$i); } } echo var_dump(array_count_values(\$firstarray)); echo "<br>"; echo var_dump(\$secondarray); Less

### First round is pattern based question like.. n=1 n=2 n=3 * * * *** *** *** * * * * ***** ***** * * * *******

d if(n==1): l=n;m=n+1 for k in range(n+1): for b in range(l): print(end=" ") l=l-1 if(m&gt;=2): for b in range(3): print("*",end=" ") m=m-1 else: for b in range(3): print("*"*3,end=" ") print(end="\n") elif(n==2): l=n;m=1 for k in range(n+1): if(m&lt;3): for b in range(l): print(end=" ") for b in range(2): print("*",end=" ") m=m+1 else: for b in range(l-2): print(end=" ") for b in range(2): print("*"*5,end=" ") print(end="\n") elif(n==3): l=1;m=1 for k in range(n+1): if(m&lt;4): for b in range(l): print("*",end=" ") m=m+1 else: for b in range(l): print("*"*7) print(end="\n") (Code in Python) Less

def show1(n): m=4-n for _ in range(0,n): print(end=" "*n) print("*"*m,end="\n") for _ in range(m): print("*"*(n*2+1),end=" ") Less

n=int(input()) if n==1: for i in range(n+1): print(" " *(n-i)+"*"*(3*n+6*i)) elif(n==2): for i in range(3): for j in range(13): if(i in {0,1} and j in {3,5}): print("*",end="") elif(i==2 and j in {1,2,3,4,6,7,8,9,10,11,12}): print("*",end="") else: print(" ",end="") print() elif(n==3): for i in range(4): for j in range(6): if(i in {0,1,2} and j==0): print("*",end="") elif(i==3 and j in {0,1,2,3,4,5}): print("*",end="") else: print(" ",end="") print() else: print("",end="\n") Less

### whats the angle between the minute pointer and hour pointer at 3:15

at 3:15 hour arrow will indicate to 16minutes. So diff is 1 minute = 360/60 = 6 deg Less

U r right, it's 7.5 =) I was wrong and sleepy

Angle

### 12: one ring bells at 20 sec, second will 40 sec and third will 60.at what time these three will ring together?

USE LCM of these 20,40,60.

In 2nd minute

60 mins

### draw a reversed T pattern which would generate on dynamic series by giving odd input * * * * * @ @ @ @ Second Question is : * * * * * *

Okay its not getting written here!!

Reverse T for odd number. It's dynamic \$x=5; for(\$i=0;\$i'; }

Reverse T for odd number in php. It's dynamic '; } ?&gt;

### Get the last thee max salaried person from table via sql.

Just call select query with order by salary with 3 rows limit.

select top 3 salary from employee order by salary desc

"select sal from employ order by sal dec limit 3;"

### I was having 8 Yrs of experience but they asked me how to access array elements

They asked very low standard questions

Sorry that you found the question subpar. We have had a candidate once and I reviewed some of their code on screen share. I remember that the candidate had some confusion and said that Arrays is the same Hash Maps which shows lack of understanding of data structures. We are find highly skilled PHP developers who lack understanding of data structures. Unfortunately the nature of business requires our senior developers to have a good command on the basics of programming apart from knowing a language or a framework. I hope that this would explain why our interviewers might ask very basic questions to highly experiences candidates. Less

*Re-commenting because of grammatical errors in the last comment* Sorry that you found the question sub-par. We have had a candidate once who I interviewed. We reviewed some of their code on screen share and I remember that the candidate had some confusion and he believed that Arrays are the same Hash Maps which shows lack of understanding of data structures. We are finding highly skilled PHP developers who lack understanding of data structures and algorithms. Unfortunately (or fortunately), the nature of business requires all of our senior developers to have a good command on the basics of programming apart from knowing a language or a framework. I hope that this would explain why our interviewers might ask very basic questions to highly experiences candidates. Less

PHP Developer was asked...September 29, 2020

### Tell me about yourself. What technologies you learnd?

I talked about the university graduated, about the projects carried out and I listed the programming languages ​​learned. Less

I wouldn't stick it out long if your good, the tech stack is rubbish, the framework is just an out of date version of symfony. They might be tedious and pedantic about what they do, it doesn't mean they are any good or moving with the times. Less

### 1.hr interview-they check your verbal and written communication ability 2.written test consists of 10 questions with mix of javascript and php 3.technical test - here they ask you to install LAMP ,Wordpress, Virtualization and/or FTP

15k p.m

How much salary offered..?

Passed every test but didn't because of their salary offer salary offered is not at all good for freshers Less

Viewing 1 - 10 of 3,596 interview questions

## See Interview Questions for Similar Jobs

php programmerphp developerphp mysql developerphp web developer

Glassdoor has 3,596 interview questions and reports from Php software developer interviews. Prepare for your interview. Get hired. Love your job.