1. Write the results of the following code:
$a = "Hello world!";
$b = $a;
Print ("\ $b = $b
");
Print (' $a = $a
');
?>
$b =hello world!
$a = $a
' \ ' is a escape character that masks the special use of a single special character immediately following it
' Single-quote pairs, shielding the special meanings of almost all special characters included, in addition to itself
Also, debug the code at the command line,
is not used as a newline output ~ If in browser, another
2. Write the following code to output the result:
$a = "First";
$b =& $a;
$c = $a;
$a = "Second";
Print ("$a, $b, $c
");
?>
Second,second,first
$b is a $ A reference assignment, so a change of $ A is a $b change.
$c can be seen as a $ A copy once, so it is irrelevant to the two variables, so the $a change does not affect $c
21.2sbc3,2.4,0
$result 1 is a string connection, btw, if this question is 2. $b, the system will report the error
$result 2 is a multiplication of numbers, and PHP automatically discards the characters that follow the first character that is not a number.
$result 3 is the multiplication of numbers, unlike 2, there is no numeric character in the $c, so the whole is forcibly converted to a numeric type, which is 0, and then multiplied with $a=2, and the final result is 0.
4. The following incorrect variable names are:
A. $_test B. $2abc c. $Var D. $%var
B
5. Statement for ($k =0; $k =1; $k + +), and statement for ($k =0; $k ==1; $k + +); The number of executions is:
A. Infinity and 0 B. 0 and Infinity C. Are infinitely D. are all 0
A
/**
* Here to focus on this question, here to choose a should be no problem, everyone knows
The question is, if the first sentence is changed into a for ($k =0; $k =0; $k + +), then how many times does the loop experience be executed?
*
* The answer is 0.
*
* The reason is that for (expr A; expr b; expr C) We are concerned about the true value of the expression expr B when judging whether to execute the loop body.
Note $k =0 The value of this expression is 0! Instead of a possible replication, the 1 returned successfully!
* Therefore, the loop for the for loop to determine the condition is permanent, nature will not execute the loop body ~ ~ ~
*
* :)
**/
6. Features not supported by PHP functions are:
A. Variable function name b. variable number of arguments c. passing parameters by reference
D. Passing parameters by pointer E. Implementing recursive functions
D
7. The following description of the classes in PHP is not correct:
A. Support for single inheritance B. Support for multiple inheritance C. Constructors not supported D. Destructors are not supported
E. You must use the $this pointer to refer to the member variable
b Multiple inheritance seems to be using the interface
8. Locate the error in the following code and fix it:
$a [0]= "" Ryan;
$b ["Value"]=785.9;
$c ["Blue"][0]= "Ada";
Print ("$a [0], $b [" value "], $c [" Blue "][0]
");
?>
Quotes, nothing to say.
Also the key is the last line of $c[blue][0], if not enclosed in curly braces, then the system will automatically replace the variable $c[blue], the problem is that the value does not exist, so, after the replacement of Xxxx[0] will not have, so will error. This is called an array of variables.
9. Write down the precedence of the following operators in order from highest to lowest:
and,=,>,+,~
~ + > = and I guess
10. The difference between isset () and Empty ()
Isset ()
Test whether a variable exists
Empty ()
Test whether the variable is empty
In a language that is not strictly defined for variables such as PHP
If a variable has never been declared, then Isset==false|empty==true
If a variable is declared, but the assignment is null, as in the previous case
If a variable is declared but assigned a value of ', then isset==true|empty==true
If a variable is declared and is assigned a normal value, then Isset==true|empty==false
12. Write an algorithm, sort the following array in ascending order, and write out the sort algorithm name:
$arrVar =array (64,29,1,43,30,9,39,75,4,11)
Bubble sort, process slightly
13. Write a program that converts the first letter of each word in the text file to uppercase and saves it back to the original file.
Tip: Convert the first letter of the word in a string to an uppercase function: String ucwords (String str)
14. Please write down several ways that PHP accesses MySQL database, and do a brief introduction.
15. Please write out the implementation method of Phpsession, and describe the best way to implement it, and explain the reason.
Hint: The way of SessionID, the storage method of session variable and so on.
What are the vulnerabilities of the PHP program?
I am the biggest loophole ...
Do not know right ~ ~ Hehe ~ ~ found the concept of something is still quite tangled ~ ~
The word more slowly again write ~ ~ ~:)
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