-
- $str1 = null;
- $str2 = false;
- echo $str1==$str2 ? 'Equal' : 'Not equal';
- $str3 = ”;
- $str4 = 0;
- echo $str3==$str4 ? 'Equal' : 'Not equal';
- $str5 = 0;
- $str6 = '0′;
- echo $str5===$str6 ? 'Equal' : 'Not equal' ;
- ?>
Copy the code
2. Write the output of the following program
-
- $a1 = null;
- $a2 = false;
- $a3 = 0;
- $a4 = ”;
- $a5 = '0′;
- $a6 = 'null';
- $a7 = array();
- $a8 = array(array());
- echo empty($a1) ? 'true' : 'false';
- echo empty($a2) ? 'true' : 'false';
- echo empty($a3) ? 'true' : 'false';
- echo empty($a4) ? 'true' : 'false';
- echo empty($a5) ? 'true' : 'false';
- echo empty($a6) ? 'true' : 'false';
- echo empty($a7) ? 'true' : 'false';
- echo empty($a8) ? 'true' : 'false';
- ?>
Copy the code
3. Write the output of the following program
-
- $test = 'aaaaaa';
- $abc = & $test;
- unset($test);
- echo $abc;
- ?>
Copy code
4 .Write the output of the following program
-
- $count = 5;
- function get_count(){
- static $count = 0;
- return $count++;
- }
- echo $count;
- ++$count;
- echo get_count() ;
- echo get_count();
- ?>
Copy the code
5. Write the output of the following program
-
- $GLOBALS['var1'] = 5;
- $var2 = 1;
- function get_value(){
- global $var2;
- $var1 = 0;
- return $var2++;
- }
- get_value();
- echo $var1;
- echo $var2;
- ?>
Copy code
6. Write the output of the following program
-
- function get_arr($arr){
- unset($arr[0]);
- }
- $arr1 = array(1, 2);
- $arr2 = array(1, 2) ;
- get_arr(&$arr1);
- get_arr($arr2);
- echo count($arr1);
- echo count($arr2);
- ?>
Copy code
7. Use more than five kinds How to get the extension of a file
Required: dir/upload.image.jpg, find .jpg or jpg,
It must be processed using the processing functions that come with PHP. The methods cannot be obviously repeated and can be encapsulated into functions, such as get_ext1($file_name), get_ext2($file_name)
2. Algorithm questions
1. Use PHP to describe bubble sort and quick sort algorithms. The object can be an array
2. Use PHP to describe sequential search and binary search (also called binary search) algorithms. Sequential search must consider efficiency, and the object can be an ordered array
3. Write a two-dimensional array sorting algorithm function that is versatile and can call PHP built-in functions
#--------------------------
(The following answer is not necessarily the best, just a simple reference) 1 2 Next page Last page
|