


PHP interview questions sharing (blessed are those who are looking for a job)
Result 1 Int and string type cast caused ,0==="a" 0 == 0 It must be true PHP is weakly typed. . $tmp = 0 === "a"? 1: 2; echo $tmp; This is 2 4. It is known that a string is as follows: $str = "1109063 milo 1"; Use one line of code to assign 1109063 in the string to $uid, milo to $user, and 1 to $type The spaces are as follows list($uid, $user, $type) = explode(" ", $str); t is as follows list($uid, $user, $type) = explode("t", $str); list($uid, $user, $type) = sscanf($str, "%d %s %d"); $n = sscanf($auth, "%dt%s %s", $id, $first, $last); 5. List the following types of signed and unsigned ranges respectively: TINYINT SMALLINT MEDIUMINT INT TINYINT-2^7 - 2^7-10 ~ 2^8-1 SMALLINT-2^15 - 2^15-1 0 ~ 2^16-1 MEDIUMINT-2^23 - 2^23-1 0 ~ 2^24-1 INT-2^31 - 2^31-1 0 ~ 2^32-1 6. Assemble the following array into a string in one line i am milo! day day up!
7. Call the following function to get the function and get the value of count
8. Several ways to replace the session mechanism, briefly describing their respective advantages and disadvantages mysql, memcache, and cookie maintain a unique status identification code 9. Possible reasons for the following HTTP status codes and how to deal with them 200, 301, 404, 502, 503 200 The request was successful and the response headers or data body expected by the request will be returned with this response. 301 The requested resource has been permanently moved to a new location, and any future references to this resource should use one of several URIs returned with this response. If possible, clients with link editing capabilities should automatically modify the requested address to the address returned from the server. Unless otherwise specified, this response is also cacheable. The new permanent URI should be returned in the Location field of the response. Unless this is a HEAD request, the response entity should contain a hyperlink to the new URI and a brief description. If this is not a GET or HEAD request, the browser prohibits automatic redirection unless confirmed by the user, because the conditions of the request may change accordingly. Note: For some browsers that use the HTTP/1.0 protocol, when the POST request they send gets a 301 response, the subsequent redirect request will become a GET method. 404 The request failed. The requested resource was not found on the server. There is no information to tell the user whether the condition is temporary or permanent. If the server knows the situation, it should use the 410 status code to inform that the old resource is permanently unavailable due to some internal configuration mechanism problems, and there is no jump address. The 404 status code is widely used when the server does not want to reveal why the request was rejected or no other suitable response is available. 502 A server working as a gateway or proxy received an invalid response from an upstream server while trying to perform a request. 503 Due to temporary server maintenance or overload, the server is currently unable to process requests. This condition is temporary and will be restored after a period of time. If a delay can be expected, the response can include a Retry-After header to indicate the delay. If this Retry-After message is not given, the client SHOULD handle it the same way it handles a 500 response. Note: The existence of the 503 status code does not mean that the server must use it when it is overloaded. Some servers simply wish to deny connections from clients. 200 OK Everything is fine, and the response documents to GET and POST requests follow. 301 Moved Permanently The document requested by the client is elsewhere. The new URL is given in the Location header. The browser should automatically access the new URL. 404 Not Found The resource at the specified location cannot be found. This is also a common response. 502 Bad Gateway When the server acts as a gateway or proxy, it accesses the next server to complete the request, but the server returns an illegal response. 503 Service Unavailable The server failed to respond due to maintenance or overload. For example, a Servlet may return 503 when the database connection pool is full. The server can provide a Retry-After header when returning 503. 10. There is the following database, use the original mysql extension to connect and query the first ten rows of the user table host: 192.168.0.254 port: 3306 user: one pass:piece database: db_user table: user
11. Use autoload($class) to realize automatic loading of classes in the Lib directory and be compatible with subdirectories
12. Use set_error_handle to capture errors and output them, the level is determined by yourself
13. Briefly describe two methods of shielding notice warnings of PHP programs method Initialize variables, set the error level at the beginning of the file or modify php.ini to set error_reporting set_error_handler and @suppress errors 1. Add in the program: error_reporting (E_ALL & ~E_NOTICE); 2. Or modify php.ini: error_reporting = E_ALL Change to: error_reporting = E_ALL & ~E_NOTICE 3.error_reporting(0);or modify php.inidisplay_errors=Off 1 2 3 4 Next page Last page |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.
