Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the interview questions for PHP development engineers?

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the interview questions for PHP development engineers". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what are the interview questions for PHP development engineers" together!

1. Which of the following cannot add 'john' to the array $user? Answer: BD

A. $user[] = 'john';

B. array_add($user, 'john');

C. array_push($user, 'john');

D. $user ||= 'john';

2. Compare the usage of sort(), asort(), ksort() and their usage environment.

A: sort --rearrange array values from a-z and automatically replace indexes from 0... end

asort ---This function rearranges the elements of an array from a-z and maintains the correspondence between the original index values and elements. This function is mainly used for

The elements of the array need to be rearranged. This function is more common.

ksort ---This function rearranges an array from a-z according to index values

Examples:

Sort array ('a '=>111,'9'=>"orange", 6=>2,"apple");.

sort returns: Array ( [0] => apple [1] => orange [2] => 2 [3] => 111 ) values are rearranged from a-z, and the index is changed.

asort returns: Array ( [10] => apple [9] => orange [6] => 2 [a] => 111 ) values are rearranged from a-z, keeping the index for

ksort then returns: Array ( [a] => 111 [6] => 2 [9] => orange [10] => apple ) index values rearranged from a-z, keeping the cord

quote

3. The following code outputs what and why.

$num = 10;

function foo(){

$num = $num * 10;

}

foo();

echo $num;

Answer:

The result is 10. Because $num in foo() is not accessible to variables outside the function. If you want to add global $num;, you get 100.

4. The difference between a reference and an ordinary variable.

A: Common variables open up a new storage space, and references point directly to other storage spaces.

For example:

$num = 10;

function foo($num){

$num = $num * 10;

}

foo($num);

echo $num;

call foo($num); function when passed as a variable, returns 10;

If it is changed to reference transfer, return 100;

$num = 10;

function foo(&$num){

$num = $num * 10;

}

foo($num);

echo $num;

5. Method for loading class libraries.

Answer:

function __autoload($class){

require_once("./ lib/".$ class. '.php');

}

6. Difference between foo() and @foo().

A: Adding the @ symbol will block the error prompt.

As follows:

$num = 10;

function foo(&$num){

$num = $num / 0;

}

foo($num);

echo $num;

Everyone knows that divisors cannot be 0. Warning: Division by zero

7. How do you debug PHP code?

A: Use echo to type debugging or exit debugging. Plus firefox.

Thank you for reading, the above is "PHP development engineer interview questions what" content, after the study of this article, I believe that we have a deeper understanding of PHP development engineer interview questions, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report