01. Output is mozilla/4.0 (compatible; MSIE5.01; WindowNT5.0), the possible output statements are:
A $_server[' Http_user_agent_type '];
b.$_server[' Http_user_agent '];
c.$_server[' User_agent '];
d.$_server[' AGENT '];
02. The following features PHP can not achieve are:
A. Server-side script runs
B. Command-line script run
C. Client graphical Interface (GUI) programs
D. Browser-side performing DOM operations
03. The following statements are not correct:
A.php has four scalar types: boolean, Integer (integer), float (float), string
B. Floating-point (float) and double (double) are the same type
C. Composite types include: Arrays, objects (object), resources (Resource)
D. Pseudo type: Mixed type (mixed), numeric (number), Callback (callback)
04. After executing the following code,
<?php
Echo function_exists (' print ');
?>
1. function_exists determines whether the function exists, returns TRUE or False
2. Print itself is not a function, but a language structure
3. Echofalse there's nothing.
The resulting output is:
A. Empty
B.true
C.false
D.false
05. The following functions are not part of the PHP syntax:
A.array
B.eval
C.each
D.list
Echoprint
06. What is the result of executing the following code?
<?php
$bool =true;
Echo GetType ($bool);
Echo is_string ($bool);
?>
A.boolean
B.boolean0
C.booleanfalse
D.booleanfalse
*07. Write out the results of the following code execution:
<?php
$a = 12;
$b = 012;
$c =0x12;
Echo $a, "\ n", $b, "\ n", $c;
?>
12\n10\n18
08. What is the execution result of the following code?
<?php
Echo 1+2+ "3+4+5";
?>
a.0
B.3
C.6
D. " 33+4+5 ";
09. The following code joins the following function to return true:
Return? = = ' A ';
A.ord (65) Returns the ASCII code value according to the character
B.CHR (65) returns the corresponding character a==65 according to the ASCII code value a==97
c.65+ '
D. ' +65
10. The output of the following code is correct:
<?php
$a =array (1=>5,5=>8,22,2=> ' 8 ', 81);
Echo $a [7];//81
Echo $a [6];//22
Echo $a [3];
?>
A. Empty 2281 B. Empty 8122 c.8122 empty D. Empty
11. The output of the following code:
<?php
$a [bar]= ' Hello ';
Echo $a [Bar];//hello
echo $a [' Bar '];//hello
?>
A.hello B. Empty C. Error D.hellohello
*12. Write out the results of the following code:
<?php
Echo 1>>0; 0001
Echo 2>>1; 0010-> 0001
Echo 3<<2; 0011-> 1100
?>
a.012 b.106 c.1112d.123
13. The following descriptions of Echo,print are correct:
A.echo,print can print multiple parameters
B.print can print multiple parameters, echo cannot be
C.echo can print multiple parameters, print can not
D.echo,print can not print multiple parameters
14. For the following code
<?php
$fruits =array (' Strawberry ' => ' red ', ' banana ' => ' yellow ');
?>
The code that can correctly get the result ' yellow ' is:
A.echo "A Banana is {$fruits [' banana ']}";
B.echo "A Banana is $fruits [' banana ']";
C.echo "A Banana is {$fruits [banana]}";
D.echo "A banana is $fruits [banana]";
15. What is the result of the following code execution.
<?php
Function Change () {
static$i=0;
$i + +;
return$i;
}
Printchange ();
Printchange ();
?>
12
16. After the execution of the following code, the $result value is:
<?php
$srcArray =array (' A ', ' B ', ' C ', ' d ');
$randValue =array_rand ($srcArray);
$result =is_string ($randValue);
?>
1. Array_rand return what.
2. Is_string () return value
A, a
B, False
C, Trueb
D, b
E, C
17.<?phpecho count (' 123 ')?> output is.
A, 3
B, False
C, NULL
D, 1
E, 0
18. After the execution of the following code, the $result value is:
<?php
$a = ' 01 ';
$result = 1;
If (In_array ($a, Array (' 1 ')) {
$result = 2;
}elseif ($a = = ' 1 ') {
$result = 3;
}elseif ($a = = ' 01 ') {
$result = 4;
}else{
$result = 5;
}
?>
A, 1
B, 2
C, 3
D, 4
E, 5
19.php function name is case-sensitive?
A, no distinction
B, distinguishing
20. After the execution of the following code, the $result value is:
<?php
$x = "";
$result =is_null ($x);
?>
A, NULL
B, True
C, False
D, 1
21. Which OOP Setup mode allows the class to be instantiated only once in the entire script.
A, MVC
B, Agent Mode
C, State mode
D, Abstract Factory model
E, single-piece mode
22. By virtue of inheritance, we can create derived classes of other classes. In PHP, a subclass can inherit up to a few parent classes.
A, a
B, 2
C, depending on system resources
D, 3
E, want a few have a few
23. Which of the following types of errors cannot be captured by a custom error processor? (double selection) Set_error_handler
A, e_warning
B, E_user_error
C, E_parse
D, E_notice
24. Execute the following code, the output result is
<?php
Abstract class a{
Function __construct () {
Echo "a";
}
}
$a =new A ();
?>
A, a
B, an error warning
C, a fatal error
25. Execute the following code, enter the result is
<?php
Class a{
Function __construct () {
echo "Echo ClassA something";
}
}
Class B extends a{
Function __construct () {
echo "Echo classb something";
}
}
$a =new B ();
?>
A, echoclassasomethingechoclassbsomething
B, echoclassbsomethingechoclassasomething
C, echoclassassomething
D, Echo Class B something
26. Which of the following options does not add John to the users array. 2 points
(A) $users [] = ' John ';
(B) Array_push ($users, ' John ');
(C) $users | | = ' John ';
(D) Array_unshift ($users, ' John ');
27. In PHP, the ' + ' operator's function does not include 2 points
A. String concatenation
B. Array Data Merge Array (0=>1,1=>2) +array (2=>3,3=>4)
C. Add Variable data
28. Which of the following expressions cannot concatenate two strings $s1 and $s2 into a single string. ( )
A. $s 1+ $s 2 B. " {$s 1} {$s 2} "C. $s 1. $s 2
D. Implode (', array ($s 1, $s 2)) E. All of the above methods can be achieved
29. After the following script is run, $array the value that the array contains. ( )
$array = Array (' 1 ', ' 1 ');
foreach ($array as $k => $v) {
$v = 2;
}
A.array (' 2 ', ' 2 ') B.array (' 1 ', ' 1 ') C.array (2,2) D.array (null,null)
The role of the 30.array_shift () function is.
A adds an element to the array
B-Shift an element in an divisor group
C Exchange key and value Array_flip for an array ()
D clears an array
fill in the blanks
1. The execution segment <?php echo 8% ( -2)?> outputs ___0_.
* 2, the Apache module to install PHP, in the file httpd.conf first to use the statement LoadModule php5_module "F:/wamp/php-5.2.6-win32/php5apache2_2.dll" __ Dynamically load the PHP module and then use the statement __ addtypeapplication/x-httpd-php. PHP__ enables Apache to process all files that have extensions php as PHP scripts.
3, the properties of the class can be serialized and saved to the session, so that the entire class can be restored later, the function to be used is _serialize___.
4, the __DEBUG_BACKTRACE___ function can return the name of a function called in any row in the script. The function is also frequently used in debugging to determine how the error occurred.
5. $str = "CD";
$ $str = "ABCDE"; $CD = "ABCDE"
$ $str. = "OK"; $cd. = "OK";
ECHO$CD; Echo $CD;
?>
This section of code output is ___abcdeok____
read the question of the journey
1, (5 points) Please indicate the error of the following code (circled and corrected)
function Baz ($y,$a) {
$x =new Array ();
$x [' sales '] = 60;
$x [' profit '] = 20;
foreach ($xas $key =>$value) {
Echo$key + "" + $value + "<BR>";
}
}
2. Write out the output of the following program (1 points)
$b = 201;
$c = 40;
$a = $b > $c 4:5;
echo $a;
4
3, the following program will output what 1 points)
$num = 10;
function Multiply () {
$num = $num * 10;
}
Multiply ();
Echo $num;
Ten
4, please write the following PHP code execution results 6 points
$var 1 = 5;
$var 2 = 10;
Functionfoo (& $my _var) {
GLOBAL$VAR1;
$var 1 +=2;
$var 2 = 4;
$my _var +=3;
RETURN$VAR2;
}
$my _var = 5;
Echofoo ($my _var). " \ n ";//4
echo $my _var. " \ n ";//8
echo $var 1. " \ n ";//7
echo $var 2. " \ n ";//10
$bar = ' Foo ';
$my _var = 10;
Echo$bar ($my _var). " \ n ";//4
5, write out the following code output:
function MyFunc ($argument) {
echo $argunment + 10;
}
$variable = 10;
echo "MyFunc ($variable) =". MyFunc ($variable);
20myfunc (10) =
6. Write out the output of the following program (5 points)
$test = ' aaaaaa ';
$ABC =& $test;
Unset ($test);
echo $abc;//aaaaaa
7, write out the results of the program operation
$a = 0;
$b = 0;
If ($a =3| | $b =3) {
$a + +; true++
$b + +; 0++
}
echo$a. ",". $b; 1,1
$a = 0;
$b = 0;
If ($a = (3| $b =3)) {
$a ++;//3++
$b ++;//3++
}
echo$a. "," $b;//4,4
Result: 1._______1,1__________,2._________4,4_____________
8,
<?php
$data = Array (' A ', ' B ', ' C ');
foreach ($data as $key => $val) {
$val = & $data [$key];
}
?>
Question 1: When the program executes, what is the value of the variable $data at the end of each loop? Please explain.
Question 2: What is the value of the variable $data after the program is executed? Please explain.
question and Answer question
1, the implementation of the text string interception without garbled method. (3 points)
Mb_substr ()
2, the output of the user's IP address, and to determine whether the user's IP address in the 192.168.1.100---192.168.1.150 (5 points).
Ip2long ("192.168.1.100") ip2long (' 192.168.1.150 ')
3, constantly in the file Hello.txt head to write a line "Hello world" string, requiring code integrity (10 points)
$str = file_get_contents ("Hello.txt");
$str = "HelloWorld". $str;
File_put_contents ("Hello.txt", $str);
4, please list 3 kinds of PHP array loop operation syntax, and indicate the advantages and disadvantages of each cycle 5 points
For only looping subscript consecutive index arrays
Foreach can loop through all arrays
While is similar to for
while (list ($key, $val) =each ($arr) is less readable and inefficient
5, to find the difference of two dates, such as 2007-2-5~2007-3-6 date difference (5)
(Strtotime (' 2007-3-6 ')-strtotime ("2007-2-5"))/(3600*24)
6. Please reorder the 2-d array by the length of name, and assign the ID (starting from 1) in order. (15 points)
$array = Array (
Array (' ID ' => 0, ' name ' => ' 123 '),
Array (' ID ' => 0, ' name ' => ' 12345 '),
Array (' ID ' => 0, ' name ' => ' 1234 '),
Array (' ID ' => 0, ' name ' => ' 123ABCD '),
Array (' ID ' => 0, ' name ' => ' 123456 '),
);
)
For ($j =0, $c =count ($array); $j < $c; $j + +) {
for ($i =0; $i < $c-$j; $i + +) {
if (strlen ($array [$i] [' name ']) >strlen ($array [$i +1][' name ']) {
$tmp = $array [$i];
$array [$i]= $array [$i +1];
$array [$i +1]= $tmp;
}
}
$array [$c-$j] [' ID ']= $c-$j;
}
$arr = Array ();
foreach ($Tarray as $k => $v)
{
$arr [$k] = strlen ($v [' name ']);
}
Natsort ($arr);
$arr 1 = array ();
$i = 0;
foreach ($arr as $k => $v)
{
$arr 1[$i] [' id '] = $v;
$arr 1[$i] [' name '] = $Tarray [$k] [' name '];
$i + +;
}
8. What is the function of error_reporting in PHP? (1 points)
Change the error level
9, describe how to get the current execution script path, including the obtained parameters. (2 points)
$_server[' Request_uri ']
10. What is the difference between mysql_fetch_row () and mysql_fetch_array? (1 points)
Mysql_fetch_row ()