PHP 11 Most frequently asked questions and answers, PHP question _php tutorial

Source: Internet
Author: User
Tags pear what php

PHP 11 Most frequently asked questions and answers, PHP questions


Are you looking for a PHP development job, and are you looking for some questions and answers about PHP? This article shares some of the 11 most frequently asked PHP interview questions, as well as the corresponding regular answers, each company has its own interview criteria, interviews and questions are entirely dependent on your role in the work, of course, and your programming skills are closely related.

Question: Please tell me in the simplest language what PHP is?

Answer: PHP full name: Hypertext preprocessor, is a server scripting language used to develop dynamic Web sites.

Question: What is MVC?

Answer: MVC consists of model, view, and controller, and PHP MVC can manage 3 different layers of PHP code more effectively.

Model: Data information access layer.
The View:view layer is responsible for presenting the applied data in a specific way on the interface.
Controller: It is common for controllers to read data from the view, control user input, and send data to the model.

Question: Are there several ways to reference CSS in a page?

Answer: There are 3 ways to use CSS in the page:
referencing external CSS files
Internally defined style style
inline style

Question: Does PHP support multiple inheritance?

Answer: No, you can't. The PHP class can inherit only one parent class and is identified with the keyword "extended".

Question: What is the difference between echo and print in PHP?

These two look very similar, because they all print some values on the screen. But the essential difference between echo and print is that echo is used to output strings, which can be separated by commas when displaying multiple values. Only basic types are supported, and print can print not only string values, but also the return values of the functions.

Question: What is the difference between the Get and post methods?

Answer: The form information that we fill out on the webpage can pass the data to the server through these two methods, when we use Get method is, all information will appear in the URL address, and use Get method can only pass 1024 characters, Therefore, you can use the Get method if the transfer volume is small or the security is less important. When it comes to the post method, you can transfer up to 2MB bytes of data and adjust it as needed.

Question: What is the way to get the size of an image in PHP?

Answer: getimagesize () Get the size of the picture
Imagesx () Get the width of the picture
Imagesy () Get the height of the picture

Question: What is pear in PHP?

Answer: Pear is the PHP extension and application Library (PHP Extension and Application Repository), which is a code repository for PHP extensions and applications.

Question: How do I upload videos in PHP and MySQL?

Answer: We can store the address of the video in the database without having to have the real video data in the database. The video data can be stored in the server's specified folder, the default size of the upload is 2MB, but we can also modify the max_file size option in the php.ini file to change.

Question: What are the types of errors in PHP?

Answer: There are roughly 3 types of errors encountered in PHP.

Tip: It's all very normal information, not a big mistake, and some won't even show it to the user. For example, access to non-existent variables.
Warning: This is a bit of a serious error that will present the warning message to the user, but will not affect the output of the code, such as containing some files that do not exist.
Error: This is a real serious error, such as accessing a nonexistent PHP class.

Question: How do I define Constants in PHP?

Answer: PHP uses define () to define constants.
Copy the Code code as follows:
Define ("Newconstant", 30);

Question: How do I submit a form without using the Submit button?

If we do not want to submit the form with the Submit button, we can also use hyperlinks to submit, we can write the code:
Copy the Code code as follows:
Submit Me


PHP Programmer on Plane test (with answer, answer good plus points)

PHP face test for a large company

Admin Reminder: This post was haowubai to perform the unpin operation (2009-07-30)
1. How do I get the content of a Web page address using PHP's environment variables? How do I get an IP address?
[PHP]
echo $_server [' php_self '];
echo $_server [' server_addr '];
[/php]

2. Ask for the difference of two dates, for example, 2007-2-5 ~ 2007-3-6 Date Differential
[PHP]
$begin =strtotime (' 2007-2-5 ');
$end =strtotime (' 2007-3-6 ');
Echo ($end-$begin)/(24*3600);
[/php]

3. Write a function to perform the following functions:
The string "Open_door" is converted to "Opendoor", "make_by_id" to "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. Required to write a program, to achieve the following array $arr1 conversion of the group $ARR2:
[PHP] $arr 1 = 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 ')
);
$arr 2 = array ... Remaining full text >>

PHP face questions and answers, PHP pen questions

The principle and application of Java anomaly mechanism
A: Every time the program has an exception, if the program does not handle the corresponding, the program will be interrupted.
In fact, after an exception is generated, the JVM throws an instantiated object of the exception class, and if it is captured with a try statement at this point, it can handle the exception, otherwise it will be given to the JVM for processing. When the try statement catches an exception, it matches the exception type of the catch statement and executes the statement within the catch if the match succeeds. Simple application: Add Try-catch to the place where the throws statement is. Standard application: Try-catch-finally-throw-throws is used together.
2. Advantages of the garbage collection mechanism
Answer: Free up space occupied by useless objects. Method: Automatic recovery, manual recovery. Using System.GC (), you actually call Runtime.getruntime (). GC ()
3. Difference between error and exception
Answer: Error is JVM processing, JVM error
Exception can be handled by the program, can be captured with Try-catch
4. Final,finally,finallize
A: The value of a final defined variable cannot be changed, the defined method cannot be overridden, and the defined class cannot be inherited
Finally is the exception of the unified export, Finallize is garbage collection before the finishing work, is defined by the object class
5. Anonymous Inner class can be extends, can implements Interface
A: Allow inheritance and implementation, because anonymous inner classes are developed on the basis of abstract classes and interfaces.
6. The difference between Static Nested class and inner class
A: class that is defined with static is an external class that can be passed through an external class. Internal Class direct Access
The inner class cannot be accessed externally, only through an instance of an external class to find an inner class instance.
7. HashMap and HashTable?
A: Hashmap:1) released in JDK 1.2,new Class 2) with asynchronous processing, high performance, non-thread-safe 3) allow null
Hashtable:1) released in JDK 1.0, Old Class 2) with synchronous processing, low performance, thread-safe 3) does not allow null
8. What does the assert represent?
A: Asserts is a new keyword released after JDK 1.4, which means that the assertion that the program executes somewhere is definitely the expected value, and general development is seldom used. To use Assert, you must add the-ea parameter
9. What is a GC?
A: GC is garbage collection, garbage collection, GC can be used to release the garbage space
Ten. String s = new string ("XYZ") produces several objects?
A: An anonymous object xyz, within the stack space. A new instantiated object, within the heap space.
One. Sleep () and wait ()?
A: Sleep () is the thread class definition method, which indicates that the thread is dormant and can wake automatically
The wait () method is a method defined by the object class that requires manual notify () and Notifyall ()//sleep () to not release resources, and Wait () to release resources
Goto is present in Java, but cannot be used
13. Does the array have length (), string has no length ()?
Answer: The array has the Length property, string has length ()
The difference between overload and override
Answer: Overload: Reload
|-several methods defined in a class
|-All method names are the same, but the parameter type or number is different
|-parameter only, not related to return type
Overrid ... Remaining full text >>

http://www.bkjia.com/PHPjc/873343.html www.bkjia.com true http://www.bkjia.com/PHPjc/873343.html techarticle PHP 11 Questions and answers with the highest frequency, PHP questions are you ready to look for a PHP development work, and also looking for some questions and answers about PHP? This article is for ...

  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.