Table of Contents
PHP interview question set, PHP test questions
PHP programmer computer interview questions (with answers, bonus points for good answers)
PHP interview questions? Hurry
Home Backend Development PHP Tutorial PHP interview question set, PHP test questions_PHP tutorial

PHP interview question set, PHP test questions_PHP tutorial

Jul 13, 2016 am 10:16 AM
php programmer

PHP interview question set, PHP test questions

Han~~ I did some PHP questions on the Internet, and I have reached this point without realizing it... Post the answers
If you have any questions, please feel free to add and correct me

1. Use PHP to print out the time of the previous day in the format of 2006-5-10 22:21:21 (2 points) ​ $a = date("Y-m-d H:i:s", strtotime("-1 day")); print_r($a);

​ 2. The difference between echo(), print() and print_r() (3 points) ​ echo and print are not a function, but a language structure int print(string $arg), only one parameter echo arg1,arg2; can output multiple parameters and return void echo and print can only print out strings, not structures. print_r can print out the structure for example $arr = array("key"=>"value"); print_r($arr);

​ 3. Templates that enable HTML and PHP to be used separately (1 point) smarty,phplib

​ 4. What tools are used for version control? (1 point) svn,git,cvs

​ 5. How to implement string flipping? (3 points) English: strrev($a) ​ Chinese or other text: ​ Chinese: GB2312, the code is encoded using GB2312 len=mbst rwidth(str,"GB2312"); for(i=0;i< len;i++) { arr[]=mb substr(str, $i, 1, "GB2312"); } return implode("", array_reverse($arr)); } print_r(reverse("Hello"));

​ -------------------------------------------------- ------------- ​ 6. Methods to optimize MYSQL database. (4 points, write more and get more) ​ In terms of sentences: 1 Use indexes to increase query efficiency 2 Optimize query statements and improve index hit rate ​ Database aspects involved: 1 Construct sub-databases and tables to improve the storage and expansion capabilities of the database 2 Use different storage engines as needed

​ 7. The meaning of PHP (send 1 point) ​ hypertext preprocessing language Hypertext PreProcessor

​ 8. What is the function that MYSQL uses to obtain the current time?, and the function that formats dates is (2 points) CURRENT_TIMESTAMP() DATE_FORMAT() select DATE_FORMAT("2011-11-21 10:10:10", "%Y-%m-%d");

​ ​ 9. A method to intercept Chinese text strings without garbled characters. (3 points) mb_substr($str, 1, 1, "GB2312");

​ -------------------------------------------------- ------------- ​ 10. Have you ever used version control software? If so, what is the name of the version control software you used? (1 point) svn git

​ 11. Have you ever used a template engine? If so, what is the name of the template engine you used? (1 point) smarty

​ 12. Please briefly describe your most proud development work (4 points) XXX

​ 13. For websites with large traffic, what methods do you use to solve the traffic problem? (4 points) 1 Effectively use cache to increase cache hit rate 2 Use load balancing 3. Use CDN to store and accelerate static files 4 ideas to reduce database usage 5 Check where the statistical bottlenecks are

​ -------------------------------------------------- --------------- ​ 14. Use PHP to write the code to display the client IP and server IP 1 point) $_SERVER["REMOTE_ADDR"] $_SERVER["SERVER_ADDR"]

​ 15. What is the difference between the include and require statements? To avoid including the same file multiple times, they can be replaced by (?) statements? (2 points) On failure: include generates a warning, while require generates an error interrupt directly. ​ require is loaded before running include is loaded at runtime ​ require_once include_once

​ 16. How to modify the survival time of SESSION (1 point). session_set_cookie_params

​ ​ 17. There is a web page address, such as the PHP Research Laboratory homepage: http://www.phpv.net/index.html, how to get its content? ($1 point) file_get_contents ​ curl

​ 18. In HTTP 1.0, the meaning of status code 401 is (?); if the prompt "File not found" is returned, the header function can be used, and its statement is (?); (2 points) Unauthorized ​ header("HTTP/1.0 404 Not Found"); ​ In fast CGI: header("Status: 404 Not Found");

​ ​ 19. In PHP, heredoc is a special string, and its end mark must be? (1 point) appear in pairs $a = <

​ 20. Talk about the advantages and disadvantages of asp, php and jsp (1 point) asp needs to rely on IIS and is a language developed by Microsoft php and jsp can rely on other servers such as apache or nginx

​ 21. Talk about your understanding of mvc (1 point) model: data structure layer view: display control: receive and judge processing input

​ ​ -------------------------------------------------- ------------------ ​ 22. Write the SQL of the names of the ten people with the most posts, using the following table: members (id, username, posts, pass, email) (2 points) select top 10 id,username from members order by posts desc

​ 23. Please explain the difference between passing by value and passing by reference in PHP. When to pass by value and when to pass by reference? (2 points) & means passing by reference Passing parameters by reference in a function will change the parameters Generally, you can consider using references when there are multiple output parameters.

​ 24. What is the function of error_reporting in PHP? (1 point) Set the display level of error

​ 25. Please write a function to verify whether the format of the email is correct (2 points) $str = "jianfeng@126.com"; regex="( [az09.]+)@([daz.]+).([az.]2,6) " ; //Regular return preg_match(regex,str)

​ ​ 26. Briefly describe how to get the current execution script path, including the obtained parameters. (2 points) $argc -- Get the number of parameters $argv -- Get the parameter list

​ 27. How to modify the survival time of SESSION. (1 point) session_set_cookie_params

-------------------------------------------------- ------------------ ​ 28. What is the function to pop up a dialog box in a JS form? What is the function to get input focus? (2 points) alert() confirm() prompt() ​ focus()

​ 29. What is the redirection function of JS? How to introduce an external JS file? (2 points) window.location.href="#" ​

​ 30. What is the difference between foo() and @foo()? (1 point) @ represents all warnings to be ignored

​ 31. How to declare a class named "myclass" without methods and attributes? (1 point) class myclass { }

​ 32. How to instantiate an object named "myclass"? (1 point) $myclass = new myclass();

​ 33. How do you access and set the properties of a class? (2 points) n=a->name; print_r($n);

​ 34. What is the difference between mysql_fetch_row() and mysql_fetch_array? (1 point) mysql_fetch_array() is an extended version of mysql_fetch_row(). In addition to storing data in an array as a numerical index, you can also store data as an associative index, using the field name as the key.​ ​ row=mysqlfetcharray( result, MYSQL_ASSOC)) {
printf ("ID: %s Name: %s", row["id"],row["name"]); } ​ Mysql_free_result($result);

​ -------------------------------------------------- ------------------ ​ 35. What is the GD library used for? (1 point) Dynamic and open image processing library

​ 36. Point out some ways to enter a piece of HTML code in PHP. (1 point) echo "{html}" echo <

​ 37. Which of the following functions can open a file for reading and writing? (1 point) c (a) fget() (b) file_open() (c) fopen() (d) open_file()

​ 38. Which of the following options does not add john to the users array? (1 point) b (a) $users[] = ‘john’; ​(b) array_add($users,’john’); (c) array_push($users,‘john’); (d) $users ||= ‘john’;

​ 39. Will the following program be input? (1 point) 10 ​$num = 10; function multiply(){ num=num * 10; } ​multiply(); echo $num; ?>

​ 40. Use PHP to write a simple query to find out all the content named "Zhang San" and print it out (2 points) Table Name UserName Tel Content Date Zhang San 13333663366 Graduated from college 2006-10-11 Zhang San 13612312331 Undergraduate degree 2006-10-15 Zhang Si 021-55665566 Graduated from technical secondary school 2006-10-15 Please complete the code according to the above questions: ​$mysql_db=mysql_connect("local","root","pass"); ​@mysql_select_db("DB",$mysql_db); $sql = sprintf("select * from %s where UserName = '%s'", "table name", "Zhang San"); values=mysqlquery( sql); while(item=mysq lfetchqueryarray(values)) { echo sprintf("Username: %s, phone number %s, education: %s, graduation date: %s", item[Us erName],item['Tel'], item[C ontent],item ['Date'] ); }

​ 41. How to use the following classes and explain what they mean? (3) class test{ ​function Get_test($num){ num=md5(md5(num)."En"); ​return $num; } } $test = new test(); ret=test-> Get_test(11); print_r($ret);exit; ​ Connect the 32-bit string a1 generated after MD5 encoding of num with "En" and then perform MD5 encoding again.

-------------------------------------------------- -------------------------- ​ 42. Write the format of SQL statements: insert, update, delete (4 points) Table Name UserName Tel Content Date Zhang San 13333663366 Graduated from college 2006-10-11 Zhang San 13612312331 Undergraduate degree 2006-10-15 Zhang Si 021-55665566 Graduated from technical secondary school 2006-10-15 (a) There is a new record (Xiao Wang 13254748547 graduated from high school 2007-05-06). Please use SQL statements to add it to the table. insert into table name values('Xiao Wang', '13254748547', 'High School Graduation', '2007-05-06') ​ (b) Please use sql statement to update Zhang San’s time to the current system time update table name set Date = GETDATE() where UserName = "Zhang San" ​ (c) Please write to delete all records named Zhang Si delete from indicates where UserName = "Zhang Si"

​ 43. Please write the meaning of data type (int char varchar datetime text); what is the difference between varchar and char (2 points) int integer type char storage fixed length varchar storage variable length datetime time text stores variable length ​ varchar is variable length char(20) fixed length

​ 44. MySQ auto-increment type (usually table ID field) must be set to (?) field (1 point) auto_increment ​ 45. Write the output of the following program (1 point) ​$b=201; ​$c=40; ​a=b>$c?4:5; echo $a; ?> ​ 4

​ 46. ​​Is there a function that detects whether a variable is set? What is the function that detects whether it is empty? (2 points) isset() empty()

​ -------------------------------------------------- -------------------------- ​ 47. What is the function to obtain the total number of query result sets? (1 point) mysql_num_rows()

​ 48. $arr = array('james', 'tom', 'symfony'); Please print out the value of the first element (1 point) print_r($arr[0]); ​ reset($arr); print_r(current($arr)); ​ print_r(array_shift($arr));

​ 49. Please separate the values ​​of the array in question 41 with ',' signs and merge them into string output (1 point) implode

​ 50. a=abcdef;Pleasetakeout The value of a and print out the first letter (1 point) $a[0]; ​ substr($a, 0, 1);

​ 51. Can PHP be connected to databases such as sql server/oracle? (1 point) Can There are ready-made libraries

​ 52. Please write the PHP5 permission control modifier (3 points) public private protected

​ 53. Please write the constructor and destructor of php5 (2 points) public function __construct() { } ​ public function __destruct() { }

​ Programming questions ​ ​ 1. Write a function to retrieve the file extension from a standard URL as efficiently as possible For example: http://www.sina.com.cn/abc/de/fg.php?id=1 needs to remove php or .php ​ arr=pars eurl( url); pathArr=pathinfo(arr['path']); print_r($pathArr['extension']);

​ 3. Write a function to calculate the relative paths of two files For example $a = '/a/b/c/d/e.php'; ​$b = '/a/b/12/34/c.php'; Calculate b phase versus in a The relative path should be http://www.cnblogs.com/ 12/34/c.php will be added

  path, conpath) { pathArr=expode("/",path); conpathArr=explode("/",conpath); $dismatchlen = 0; for(i=0;i < count(pahrr) ;i++) { if(conpthAr r[i] != pathArr[i]) { dismatchlen=count(pathArr) - $i; arrLeft=arrayslice(pathArr, $i); break; } } ret=strrepeat("../",dismatchlen).implode("/", $arrLeft); return $ret; }   print_r(sGetRelativePath(b,a));

 

      3.写一个函数,能够遍历一个文件夹下的所有文件和子文件夹。

 

handle=opendir(folder);
while((file=readdir(handle)) !== false) { //如果是.或者..则跳过 if(file=="."||file == "..") { continue; } if(is_file(folder."/".file)) { aFileArr[]=file;  }else if(is_dir(folder."/". file)) { aFileArr[file] = aGetAllFile(folder."/".file); } } closedir($handle); } return $aFileArr; } ​ $path = "/home/test/sql"; print_r(aGetAllFile($path));

PHP programmer computer interview questions (with answers, bonus points for good answers)

PHP interview questions from a large company

Management reminder: This post was unpinned by haowubai (2009-07-30)
1. How to use PHP environment variables to get a web page address content? How to get the ip address?
[php]
echo $_SERVER ['PHP_SELF'];
echo $_SERVER ['SERVER_ADDR'];
[/php]

2. Find the two dates Difference, such as the date difference from 2007-2-5 ~ 2007-3-6
[php]
$begin=strtotime('2007-2-5');
$end=strtotime( '2007-3-6');
echo ($end-$begin)/(24*3600);
[/php]

3. Please write a function to implement the following functions :
The string "open_door" is converted into "OpenDoor", "make_by_id" is converted into "MakeById".
[php]
function changeStyle(& $str) {

/*$str = str_replace ( "_", " ", $str );
$str = ucwords ( $ str );
$str = str_replace ( " ", "", $str );
return $str;*/

$arrStr=explode('_',$str);
foreach($arrStr as $key=>$value){
$arrStr[$key]=strtoupper(substr($value,0,1)).substr($value,1);
}
return implode('',$arrStr);
}
$s = "open_door";
echo changeStyle ( $s );
[/php]

4. It is required to write a program to convert the following array $arr1 into array $arr2:
[php]$arr1 = array (
'0' => array ('fid' => 1, ' tid' => 1, 'name' =>'Name1' ),
'1' => array ('fid' => 1, 'tid' => 2 , 'name' => ;'Name2' ),
'2' => array ('fid' => 1, 'tid' => 5 , 'name' =>'Name3' ),
'3' => array ('fid' => 1, 'tid' => 7 , 'name' =>'Name4' ),
'4' => array ('fid' => 3 , 'tid' => 9, 'name' =>'Name5' )
);
$arr2 = array...The rest of the text>>

PHP interview questions? Hurry

Friends who are looking for a job can take a look, but don’t think that these are necessarily useful. Sometimes work experience is also very important. However, the basic knowledge points are still very important. As for the algorithmic issues in high-level, if you are not doing particularly important tasks, you will not encounter these algorithms (except for online games); in high-level photo album processing, if you can really handle it, you can do it alone Selling a product is not a problem.

1. Basic knowledge points
The meanings of several status codes in the HTTP protocol: 503 500 401 200 301 302
The difference between Include require include_once require_once.
Several versions in PHP/Mysql The evolutionary history, such as major improvements from mysql4.0 to 4.1, PHP 4.x to 5.1, etc.
Introduction to HEREDOC
Write some PHP magic methods;
Some configure parameters when compiling PHP
Two ways to pass parameters to PHP.
(mysql) Please write the meaning of the data type (int char varchar datetime text); What is the difference between varchar and char;
Error_reporting and other debugging functions are used
Have you ever used version control software? If so What is the name of the version control software you use?
The difference between posix and perl standard regular expressions;
What are the restrictions after Safe_mode is turned on.
Write code to solve the problem of multiple processes/threads reading and writing a file at the same time problem.
Write a piece of code to upload files.
Mysql storage engine, the difference between myisam and innodb.

2. Web architecture, security, project experience
Introducing the experience of using xdebug, apc, eAccelerator, Xcache, Zend opt.
Use mod_rewrite, when there is no physical file /archivers/567.html on the server, redirect to index.php?id=567, please turn on mod_rewrite first.
MySQL database is used as the storage of the publishing system, five times a day The increment of more than 10,000 items is expected to be operated and maintained for three years. How to optimize it?
Write a sorting algorithm (principle) and tell how to optimize it.
Please briefly describe your most proud development work
For high-traffic websites, what method do you use to solve the statistical problem of page visits
Have you ever used a template engine? If so, have you used it? What is the name of the template engine?
Please introduce the principle of Session, and what should be paid attention to in terms of Session in large websites?
Tools for testing PHP performance and MySQL database performance, and methods to find bottlenecks.
Regularly proposes all links in a web page.
Introducing the principles of common SSO (single sign-on) solutions (such as dedecms integrating discuz's passport).
The characteristics of the PHP framework you have written, what problems it mainly solves, and its differences from other frameworks.
What are the differences in performance optimization between large forums/news article systems/SNS websites?
Photo album applications: multiple files are required to be selected and uploaded at the same time in the browser, and pictures are required to be cropped and compressed in Server-side decompression. Can upload a single file up to 50M. A progress bar is displayed during the upload process. Thumbnails of four sizes can be generated for each picture, and the video files must be converted into flv for flash playback. Describe the various types of open source software to be covered and their simple uses.
A group of monkeys line up in a circle and are numbered according to 1, 2,..., n. Then start counting from the 1st one, count to the mth one, kick it out of the circle, start counting from behind it, count to the mth one, kick it out..., and continue in this way until the end. Until there is only one monkey left, that monkey is called the king. Programming is required to simulate this process, input m, n, and output the number of the last king. Use a program to simulate this process.

3. Basic use of unix/linux
Some methods to check the current system load information under Linux.
Basic shortcut keys for vim.
SSH security enhancement method; configuration of password mode and rsa key mode.
rpm/apt&...the rest of the text>>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/896708.htmlTechArticlePHP interview questions collection, PHP test questions~~ I did some PHP questions on the Internet, and I did it without knowing it Now...post the answer. If you have any questions, please feel free to add and correct me. 1. Use PHP to print out the previous one...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

From start to finish: How to write the perfect PHP programmer resume From start to finish: How to write the perfect PHP programmer resume Sep 10, 2023 pm 04:21 PM

How to write a perfect PHP programmer resume In a highly competitive job market, an excellent resume is crucial for job seekers. For PHP programmers, writing a perfect resume is particularly important, because the resume is not only a window to showcase your skills and experience, but also the key to attracting the employer's attention. This article will explain in detail how to write a perfect PHP programmer job resume from beginning to end. Step One: Choose a Concise and Attractive Resume Template Choosing a concise and attractive resume template is the first step in writing your resume.

Improve your job search success rate: Tips for writing an excellent PHP programmer job resume Improve your job search success rate: Tips for writing an excellent PHP programmer job resume Sep 10, 2023 pm 06:30 PM

Improve job search success rate: Tips for writing an excellent PHP programmer job resume In modern society, job hunting has become an important task faced by every graduate. When it comes to applying for a job, your resume is the most important piece. An excellent resume can win you an interview and even determine whether you can successfully get a job. Especially for a highly competitive position like PHP programmer, how to write an outstanding resume has become a key issue for every job seeker. Below I will share some tips for writing an excellent PHP programmer job resume.

How to write a PHP programmer resume that will impress employers How to write a PHP programmer resume that will impress employers Sep 08, 2023 am 08:19 AM

How to write a PHP programmer resume that will impress employers. In the highly competitive job market, it is particularly important to write an excellent resume. As a PHP programmer, in addition to your impressive work experience and skills, a resume also needs to reflect your love for programming and solid professional knowledge. This article will introduce some tips and code examples to help you write a PHP programmer resume that will shine in the eyes of employers. Concise and clear personal information The personal information section of your resume should include your name, contact information and personal website

Eye-catching PHP Programmer Resume Tips: How to Stand Out from Other Candidates Eye-catching PHP Programmer Resume Tips: How to Stand Out from Other Candidates Sep 12, 2023 am 10:16 AM

Eye-catching resume tips for PHP programmers: How to stand out from other candidates With the rapid development of the Internet industry, PHP programmers have also become one of the popular positions in the job market. However, more and more people are choosing PHP as their career development direction, which makes the competition more intense. Under such circumstances, how to make your resume stand out and become popular in the eyes of employers is a question that every PHP programmer needs to think about. First, a good resume should clearly and concisely demonstrate your skills.

PHP programmers' road to high-paying counterattack PHP programmers' road to high-paying counterattack Sep 09, 2023 am 09:22 AM

The road to high-paying counterattack for PHP programmers. With the rapid development of the Internet, the demand in the field of computer science continues to increase. In this era, people who need programming skills are most in demand. As a commonly used programming language, PHP provides programmers with a high-paying counterattack path. This article will introduce how PHP programmers can move towards a high-paying counterattack by learning PHP and related technologies, and attach some code examples. 1. Master the basic knowledge of PHP. To become an excellent PHP programmer, you first need to master the basic knowledge of PHP.

Explore Writing Tips: How to Write a Compelling PHP Programmer Job Resume Explore Writing Tips: How to Write a Compelling PHP Programmer Job Resume Sep 09, 2023 pm 04:09 PM

Explore Writing Tips: How to Write a Compelling PHP Programmer Resume In today's competitive job market, a compelling resume is especially important for PHP programmers. A good resume not only catches the employer's eye but also showcases your skills and experience. This article will explore some writing tips to help you craft a great PHP programmer resume, complete with code examples that highlight your professional abilities. Concise and clear format The format of your resume should be concise and clear, allowing employers to quickly scan your relevant information.

Improve your profile: How to write a PHP programmer resume that makes you stand out Improve your profile: How to write a PHP programmer resume that makes you stand out Sep 10, 2023 pm 05:12 PM

In today's highly competitive job market, how to stand out from the crowd of job seekers has become a very important issue. Especially for PHP programmers, a good resume can directly affect whether you can get an interview. This article will give you a detailed introduction to how to write a PHP programmer resume that makes you stand out. First of all, a good job resume should contain the following important parts: personal information, job intention, educational background, work experience, skills and expertise, and personal project experience. We will go part by part

The key step to connecting with HR: How to reflect your value in your PHP programmer resume The key step to connecting with HR: How to reflect your value in your PHP programmer resume Sep 08, 2023 am 11:30 AM

The key step to connecting with HR: How to reflect your value in your PHP programmer resume. HR evaluates and screens candidates through their resumes during a busy but brief glance during the recruitment process. To stand out from the crowd of job seekers and attract the attention of HR, you need to demonstrate your value and abilities in your resume. For PHP programmers, it is crucial to highlight their technical prowess and project experience in their resume. Here are a few key elements and how to demonstrate your value through code examples. List of technical skills in the skills section of your resume

See all articles