1. How to use PHP environment variables to get the content of a Web page address. How to get the IP address.
<?php
echo $_server [' php_self '];
echo $_server [' server_addr '];
?> 2. Ask for a difference of two dates, such as the 2007-2-5 ~ 2007-3-6 Date Difference
<?php
$begin =strtotime (' 2007-2-5 ');
$end =strtotime (' 2007-3-6 ');
Echo ($end-$begin)/(24*3600);
?>
3. Please write a function to achieve the following functions:
The string "Open_door" is converted to "Opendoor", "make_by_id" to "Makebyid".
<?php
Function Changestyle (& $str) {
/* $str = Str_replace ("_", "", $str);
$str = Ucwords ($STR);
$str = Str_replace ("", "", $str);
return $STR; *
$arrStr =explode (' _ ', $str);
foreach ($arrStr as $key => $value) {
$ARRSTR [$key]=strtoupper (substr ($value, 0,1)). substr ($value, 1);
}
Return implode (", $arrStr);
}
$s = "Open_door";
echo Changestyle ($s);?>
4. Request to write a program to achieve the following array $arr1 conversion $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 ')
)
);
<?php
$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 "<pre>";
Var_dump ($arr 2);
?>
5. Please outline 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 inefficiency of the SQL statement because it is too large.
ANSWER:
The first paradigm: if each attribute of the relation mode R is not decomposed again, it belongs to the first normal form.
Second Normal form: if R belongs to the first normal form, and all non-code attributes are fully functional dependent on the code attribute, then the second normal form.
Third normal form: if R belongs to the second normal form, and all non-code attributes are not one of the transfer functions dependent on the candidate code, it belongs to the third normal form. 6. The ID in one table has multiple records, the records of all this ID are detected, and the number of records is shown, which is implemented separately with SQL statements and views and stored procedures.
Stored procedures:
DELIMITER//
CREATE PROCEDURE Proc_countnum (in columnId int,out Rowsno int)
Begin
Select COUNT (*) into the 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_coun Tnum where member_id=1
The 7 table has a B C three column, implemented in SQL statement: Select column A When column A is greater than column B, select column B, or select column B when column B is greater than column C.
Select
Case
When First_name>middle_name Then
Case when First_name>last_name then first_name
else Last_Name End
Else
Case when Middle_name>last_name then Middle_name else last_name
End
End as name
From member
8 Describe the method of optimizing the execution efficiency of SQL statements in the project, and from what aspects, how does SQL statement performance be analyzed? Answer:sql optimization has birds, as a direct index. 9 If the template is using the Smarty template. How to use the section statement to display an array named $data. 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 in the template page. If you use a foreach statement and how to display it. ANSWER: No use for Smarty?????????????????????? Updated later. 10 write a function that can traverse all the files and subfolders under a folder. (Directory operations) <?php
$d = Dir (dirname (__file__)); echo "Handle:". $d->handle. "/n";
echo "Path:". $d->path. "/n";
while (false!== ($entry = $d->read ())) {
Echo $entry. "<br/>";
}
$d->close ();
?> 112 sheets of city and province tables. A relational table of cities and provinces, respectively.
City
ID City Provinceid
1 Guangzhou 1
2 Shenzhen 1
3 Huizhou 1
4 Changsha 2
5 Wuhan 3
.......... Guangzhou
Province:
ID Province
1 Guangdong
2 Hunan
3 Hubei
..........
(1) Write a SQL statement relationship two tables, to achieve: Display the basic information of the city.
(2) Display fields: City ID, city name, province to which it belongs.
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, how many cities are included. 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 software engineering process for the development. The following tools are used by rational Rose, PowerDesigner, Project, VSS, or CVS, TestDirector, and what are the drawbacks. The company uses Dbdesigner and CVS, the test management tool is Mantis 13. Please describe the differences between the threads of the operating system and the process. List the software you have used under Linux.
14. Use the pseudo language combined with the data structure bubble sort method to sort the following set of data 10 2 36 14 10 25 23 85 99 45.
<?php
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 "<pre>";
Var_dump ($arr);
?>
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.