The php interview questions collected on the Internet are posted for you in the php Tutorial! I. Basic question 1. what is object-oriented? What are the main features? A face object is an elegant method to directly map objects and concepts in nature to the program world! Main features: abstract, php interview questions collected on the Internet, posted for everyone in the php Tutorial!
I. basic questions
1. what is object-oriented? What are the main features?
A face object is an elegant method to directly map objects and concepts in nature to the program world!
Main features: abstraction, inheritance, encapsulation, and polymorphism
2. what is the difference between a SESSION and a COOKIE? please refer to the protocol, the cause and effect of the SESSION?
Session is a solution for the server to save the client status information. it is generally stored in the server memory, and the session timeout time is set on the server.
Cookie is a solution for saving information on the client. it is generally saved as a file, and the cookie clearing time is set in the client browser.
3. What are the meanings of codes 302, 403, and 500 in HTTP status?
302: the temporary transfer is successful. the requested content has been transferred to a new location.
403: access prohibited
500: Internal Server Error
4. create a compressed package in Linux and decode the compressed package.
Tar-cvf demo.tar demo
Tar-xcf demo.tar
5. write out the meaning of the data type (int char varchar datetime text). What is the difference between varchar and char?
Int integer
Char fixed length character
Varchar variable-length characters
Datetime date type
Text
Differences between Varchar and char
Char is a character type with a fixed length. how much space is allocated will take up.
Varchar is a variable-length character type. it can effectively save space when the content is large.
Because the varchar type is variable, when the data length changes, the server must perform additional operations, so the efficiency is lower than that of the char type.
6. What are the basic differences between MyISAM and InnoDB?
The MyISAM type does not support advanced processing such as transaction processing, whereas the InnoDB type does. MyISAM tables emphasize performance, which is faster than InnoDB, but do not support transactions. InnoDB provides advanced database functions such as transaction support and external keys.
7. do not use cookies to send a cookie to the client.
Understanding: when session_start () is enabled, a constant SID is generated. when the COOKIE is enabled, this constant is null. when the COOKIE is disabled, the PHPSESSID value is stored in this constant. Add a SID parameter after the URL to pass the SESSIONID value, so that the values in the SESSION can be used on the client page.
When the COOKIE is enabled on the client and the SESSION is enabled on the server.
When the browser requests for the first time, the server sends a COOKIE to the browser to store the SESSIONID.
When the browser sends the second request, the existing COOKIE is submitted to the server.
10. difference between isset () and empty (). the result of judging different data is $ a = 0; $ a = '0'; $ a = ''; $ a = false; $ a = null;
If Isset () is used to determine whether the existence exists, it is true, whether it is false or not.
Empty () determines whether it is null. if it is null, it is a true value. if it does not exist, it is also a true value.
Isset (): true; false
Empty (): true; true
12. how to pass variables between pages?
Get, post
II. code questions
1. write the regular expression that matches the URL.
/^ [A-zA-z] +: \/(\ w + (-\ w + )*)(\. (\ w + (-\ w + )*))*(\? \ S *)? /
2. write out common sorting algorithms and use PHP to perform bubble sorting. sort the array $ a = array () in ascending order.
$ Arr = array (233,5, 6,75454, 32 );
Mao ($ arr );
Function mao ($ arr ){
$ N = count ($ arr );
For ($ I = 0; $ I <$ n; $ I ++ ){
For ($ j = $ n-1; $ j> 0; $ j --){
If ($ arr [$ j-1]> $ arr [$ j]) {
$ T = $ arr [$ j-1];
$ Arr [$ j-1] = $ arr [$ j];
$ Arr [$ j] = $ t;
}
}
}
}
3. in the test database, the student table has the following fields: name, class, and score. Name, class, and score respectively.
1) the students in each class are sorted in descending order of their scores;
2) Check the number of passing students and the number of failing students in each class. the format is class, number of passing students, and number of failing students;
3) use PHP to write data to the connected database ("localhost", "msuser", "mspass"), execute the preceding SQL statements, display results, identify errors, and close the database;
1) SELECT * FROM student order by score desc;
3)
$ Conn = mysql_connect ('localhost', 'root', '123 ');
@ Mysql_select_db ('test ');
$ SQL = "";
$ Result = mysql_query ($ SQL );
If ($ result & mysql_affected_rows ()){
.............................
}
Mysql_close ($ conn );
?>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.