1. How do I get the content of a Web page address using PHP's environment variables? How do I get an IP address?
echo $_server[' php_self '];
echo $_server[' REMOTE_ADDR '];
?>
2. Ask for the difference of two dates, for example, 2007-2-5 ~ 2007-3-6 Date Differential
$begin =strtotime (' 2007-2-5);
$end =strtotime (' 2007-3-6);
Echo ($end-$begin)/24*60*60;
?>
3. Write a function to perform the following functions:
The string "Open_door" is converted to "Opendoor", "make_by_id" to "Makebyid".
function Changestyle ($STR) {
$arrStr =explode (' _ ', $str);
foreach ($arrStr as $key = = $value) {
$ARRSTR [$key]=strtoupper (substr ($value, 0,1)). substr ($value, 1);
$ARRSTR [$key]=ucfirst ($arrStr [$value]);
}
Return implode (", $arrStr);
}
$str 1 = "Open_door";
$str 2 = "make_by_id";
Echo Changestyle ($str 1);
Echo Changestyle ($str 2);
4. Required to write a program, to achieve the following array $arr1 conversion of the group $ARR2:
$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 (
' 0 ' = = Array (
' 0 ' = = Array (' tid ' = + 1, ' name ' = ' Name1 '),
' 1 ' = = Array (' tid ' = + 2, ' name ' = ' Name2 '),
' 2 ' = = Array (' tid ' = + 5, ' name ' = ' Name3 '),
' 3 ' = = Array (' tid ' = + 7, ' name ' = ' Name4 ')
),
' 1 ' = = Array (
' 0 ' = = Array (' tid ' = 9, ' name ' = ' Name5 ')//content from the technology world www.js4j.com technology enthusiasts//
)
);
$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 ')
);
function Changearraystyle ($arr) {
foreach ($arr as $key = = $value) {
$result [$value [' FID ']][]= $value;
}
Return Array_values ($result);
}
$arr 2=changearraystyle ($arr 1);
echo "
";
Var_dump ($arr 2);
5. Please briefly describe the paradigm and application of database design.
The general 3rd paradigm is sufficient for the optimization of the table structure, which avoids the complexity of the application and avoids the system inefficiency caused by the SQL statement being too large.
ANSWER:
The first paradigm: if each attribute of the relationship pattern R is non-decomposed, then it belongs to the first paradigm.
The second paradigm: if R belongs to the first paradigm, and all non-code attributes are fully functional dependent on the code attribute, then the second paradigm.
The third paradigm: if R belongs to the second paradigm, and none of the non-code attributes is a transfer function dependent on the candidate code, then it belongs to the third paradigm.
6. The ID in a table has multiple records, the records of all the IDs are detected, and the number of records is displayed, and the SQL statements and views, stored procedures are implemented separately.
Stored procedures://content from the technical world www.js4j.com expertise//
DELIMITER//
CREATE PROCEDURE Proc_countnum (in columnId int,out Rowsno int)
Begin
Select COUNT (*) into Rowsno from member where Member_id=columnid;
End
Call Proc_countnum (1, @no);
Select @no;
View:
CREATE View V_countnum as Select Member_id,count (*) as Countnum from member group by member_id
Select Countnum from V_countnum where member_id=1
7 table has a B C three column, implemented with SQL statement: When column A is greater than column B Select column B otherwise select column B, when column B is greater than column C, select column C otherwise.
Select
Case
When First_name>middle_name Then
Case if First_name>last_name then first_name
else Last_Name End
Else
Case if Middle_name>last_name then Middle_name else last_name
End
End as name
From member
8 Please briefly describe how the SQL statement is optimized to perform efficiently in the project.
Answer:sql optimized for bird use, it is better to index directly.
9 If the template is using the Smarty template. How to display an array named $data with the section statement. Like what:
$data = Array (
[0] = = Array ([id]=8 [name]= ' name1′)
[1] = = Array ([id]=10 [name]= ' name2′)
[2] = = Array ([id]=15 [name]= ' name3′)
......
)
Write the code on the template page? What if I use a foreach statement to display it again?
accounted for no answer.
10 write a function that can traverse all the files and subfolders under a folder. (Directory operations)
$d = Dir (dirname (__file__));
echo "Handle:". $d->handle. "\ n";
echo "Path:". $d->path. "\ n";
while (false!== ($entry = $d->read ())) {
Echo $entry. "
";
}
$d->close ();
112 Table City table and province table. A table of relations between the city and the province, respectively.
City
ID City Provinceid
1 Guangzhou 1
2 Shenzhen 1
3 Huizhou 1
4 Changsha 2
5 Wuhan 3
.......... Guangzhou//This article from the Technical World www.js4j.com Technical Course//
Province:
ID Province
1 Guangdong
2 Hunan
3 Hubei
..........
(1) Write a SQL statement relationship two tables, implementation: show the basic information of the city.
(2) Display field: City ID, city name, province.
Such as:
ID (city ID) cityname (city name) privence (province)
。。。。。。。。。
。。。。。。。。。
(2) If you want to count the number of cities in each province, please use GROUP by query.
Display fields: Province ID, province name, number of cities.
ANSWER:
1.select a.id,a.cityname,b.province from City a,province B where a.provinceid=b.id
2.select B.id,b.province,count (*) as num from city a,province B where A.provinceid=b.id GROUP by b.id
12. According to your experience, please briefly describe the steps of software development. What are the drawbacks of Rational Rose, PowerDesigner, Project, VSS, or CVS, and TestDirector used the following tools?
The company uses Dbdesigner and CVS, testing management tools with Mantis
13. Please describe the difference between the thread and the process of the operating system. List the software you used under Linux?
14. Use pseudo-language combined with data structure bubbling sorting to sort the following set of data 10 2 36 14 10 25 23 85 99 45. This article comes from the technical World www.js4j.com Technical Course// Function Bubble_sort (& $arr) {
$number =count ($arr);
for ($i =0; $i < $number-1; $i + +) {
for ($j =0; $j < $number-$i; $j + +) {
if ($arr [$j]> $arr [$j +1]) {
$tmp = $arr [$j];
$arr [$j]= $arr [$j +1];
$arr [$j +1]= $tmp;
}
}
}
}
$str = "10 2 36 14 10 25 23 85 99 45";
$arr =explode ("", $str);
Bubble_sort ($arr);
echo "
Var_dump ($arr);