YahooPHP Interview Question 3
1. how to access this special feature and change its value within a class?
2. what are the differences between include and include_once? What about require?
3. Which of the following statements can route the timer to another plane?
* Redir ()
* Header ()
* Location ()
* Redirect ()
4. Which of the following statements can be used to open a legal case so that the statement can be used?
* Fget ()
* File_open ()
* Fopen ()
* Open_file ()
5. What are the differences between mysql_fetch_row () and mysql_fetch_array?
6. what can I do in the next generation? Please refer.
$ Date = '2014/1/2 ′;
Print ereg_replace ("([0-9] +)/([0-9] +)/([0-9] + )", "\ 2/\ 1/\ 3", $ date );
The following are the answers provided by Matt Wilkin:
1. how to access this special feature and change its value within a class?
Use the following sentence: $ this-> propertyName, for example:
Class myclass
{
Private $ propertyName;
Public function _ construct ()
{
$ This-> propertyName = "value ";
}
}
2. what are the differences between include and include_once? What about require?
All three of them are used to insert other cases in the release, depending on whether url_allow_fopen approves the case, which can be obtained from the internal or external part of the system. However, there are also differences between them:
Include (): This function allows you to insert the same Upload case multiple times in your notebook. if the upload case does not exist, it will generate a system warning and generate a temporary response.
Include_once (): similar to the include () function, as shown in its name, a related case will only be inserted once during the production line.
Require (): Similar to include (). It is also used to insert other protocol cases in the intent. However, if the response does not exist, it will issue a system warning, this warning will cause a fatal warning to suspend the operation.
3. Which of the following statements can route the timer to another plane?
* Redir ()
This is not a PHP function, which may lead to incorrect response.
* Header ()
This is the correct answer. the header () is used to insert the volume information. it can be used to redirect the browser to another plane. for example:
Header ("Location: http://www.search-this.com /");
* Location ()
This is not a PHP function, which may lead to incorrect response.
* Redirect ()
This is not a PHP function, which may lead to incorrect response.
4. Which of the following statements can be used to open a legal case so that the statement can be used?
* Fget ()
This is not a PHP function, which may lead to incorrect response.
* File_open ()
This is not a PHP function, which may lead to incorrect response.
* Fopen ()
This is the correct answer. fopen () can be used to open a legal case so that it can be used. In fact, there are still many options for this function, for more information, visit php.net.
* Open_file ()
This is not a PHP function, which may lead to incorrect response.
5. What are the differences between mysql_fetch_row () and mysql_fetch_array?
Mysql_fetch_row () stores a column in a numeric partition in a zero-based partition column. The first partition is the index 0 in the primary column, and the second partition is the index 1, this is similar. Mysql_fetch_assoc () stores a column in The analyticdb table in a related column. The index in the index column is the unique bit name, for example, if I send the data query result "first_name", "last_name", and "email, the index of the comment column is "first_name", "last_name", and "email 」. Mysql_fetch_array () can return the values of mysql_fetch_row () and mysql_fetch_assoc () at the same time.
6. what can I do in the next generation? Please refer.
$ Date = '2014/1/2 ′;
Print ereg_replace ("([0-9] +)/([0-9] +)/([0-9] + )", "\ 2/\ 1/\ 3", $ date );
This refers to converting a date from MM/DD/YYYY to DD/MM/YYYY. A good friend of mine told me that this regular expression can be broken down into the following sentence. for such a simple expression, there is no need to split it, just for convenience:
// Apply one or more 0-9 pairs, and a diagonal line is added to the backend.
$ RegExpression = "([0-9] + )/";
// Apply one or more values of 0-9, and the other oblique value is added to the backend.
$ RegExpression. = "([0-9] + )/";
// Apply one or more 0-9 requests again
$ RegExpression. = "([0-9] + )";
\ 2/\ 1/\ 3 is used to apply the parameter. The first parameter is the month, the second includes the corresponding date, and the third includes the corresponding year.