Joke Collection Website - Blessing messages - Ask PHP interview machine questions
Ask PHP interview machine questions
1. How to get the content of a web address with php environment variables? How to get an ip address? [PHP]echo $ _ SERVER[' PHP _ SELF ']; echo $ _ SERVER[' SERVER _ ADDR ']; [/php]2。 Find the difference between two dates, such as the date difference between February 5, 2007 and March 6, 2007 [PHP] $ begin = strtime ('February 5, 2007'); $ end = strtotime(' 2007-3-6 '); echo($ end-$ begin)/(24 * 3600); [/php]3。 Please write a function to realize the following functions: the string "open_door" is converted into "OpenDoor" and "make_by_id" is converted into "MakeById". Function changestyle (&; $str) {/*$str = str_replace ( "_ "," ",$ str); $ str = UC words($ str); $str = str_replace("," ",$ str); Returns $ str*/$arrStr=explode('_', $ str); foreach($ arrStr as $ key = & gt; $ value){ $ arrStr[$ key]= strtoupper(substr($ value,0, 1))。 substr($value, 1); }return implosion (',$ arrstr); } $ s = " open _ doorecho change style($ s); [/php]4。 Write a program to convert the following array $arr 1 into array $ arr2: [PHP] $ arr1= array ('0' = > array ('FID' = > 1,' tid ' = & gt 1,' name ' = & gtName 1 '),' 1 ' = & gt; Array ('fid' => 1,' tid' =>2,' name' = & gtName2'),' 2' => array ('fid' => 1,' tid' =>5,' name'). 3' => array ('fid' => 1,' tid' =>7,' name' = & gtName4'),' 4' => array ('fid' =>3,' tid' =>9,' name. $ arr 2 = array(' 0 ' = & gt; Array ('0' => array ('tid' => 1,' name' = & gtName 1'),'1'= > Array ('tid' =>2,' name' = & gtName2'),' 2' => array ('tid' =>5,' name' = & gtName3'),' 3' => array ('tid' =>7,' name' = Array ('0' => array ('tid' =>9,' first name' = & gtname5'))); & lt? PHP $ arr 1 = array(' 0 ' = & gt; Array ('fid' => 1,' tid' => 1,' name' = & gtName 1'),'1'= > Array ('fid' => 1,' tid' =>2,' name' = & gtName2'),' 2' => array ('fid' => 1,' tid' =>5,' name'). 3' => array ('fid' => 1,' tid' =>7,' name' = & gtName4'),' 4' => array ('fid' =>3,' tid' =>9,' name. Function changearraystyle ($ arr) {foreach ($ arr as $ key = > $ value){ $ result[$ value[' FID ']][]= $ value; } returns array _ values ($ result); } $ arr 2 = changeArrayStyle($ arr 1); Echo "& ltpre >;;" ; var _ dump($ arr 2); [/php]5。 Please briefly describe the paradigm and application of database design. Generally, the third normal form is enough to optimize the table structure, which can avoid the complexity of application and the inefficiency of the system caused by huge SQL statements. Answer: first normal form: If every attribute of relational schema R is indecomposable, it belongs to first normal form. Second normal form: If R belongs to first normal form and all non-code property complete functions depend on code property, it is the second normal form. The third normal form: if R belongs to the second normal form and there is no non-code attribute that the transfer function depends on the candidate code, it belongs to the third normal form. 6. An Id in a table has multiple records. Find out all the records of this id, and show how many records are in * * * *, which are realized by SQL statements, views and stored procedures respectively. Stored procedure: [PHP] delimiter//create procedure proc _ countnum (in columnid int, out rows no int) begin select count (*) into rows no from member where member _ ID = columnid; endcall proc_countNum( 1,@ no); Select @ No; [/PHP]view:create view v _ Count num as select member _ id, Count (*) as count num from member group by member _ id select count num from v _ count num where member _ id =17 There are three columns in the table, which are realized by SQL statement: when column A is greater than column B, select column A, Otherwise, select column B. If column B is greater than column C, select column B. Otherwise, select column C. [PHP] Select case when first _ name > Middle name thencase when first _ name & gt surname then first name else surname Endelse case when middle _ name & gt last _ name then middle _ name else last _ name end as name from member [/PHP] 8 Please briefly describe the methods to optimize the execution efficiency of sql statements in the project, from what aspects and how to analyze the performance of sql statements. Answer: sql optimization is useless, so it is better to add indexes directly. 9 if the template is a smart template. How to display an array named $data with section statement? For example: [PHP] $ data = array ([0] = > array([id]= 8[name]= ' name 1 ')[ 1]= & gt; array([id]= 10[name]= ' name 2 ')[2]= & gt; Array ([ID] =15 [name] =' name3') ...] [/PHP] Write code on the template page? If you use the foreach statement, how to display it? There is no answer. 10 Write a function that can traverse all files and subfolders under a folder. (directory operation) [PHP]
"; } $ d->; close(); [/php] 1 1 Two tables: city table and province table. They are tables of the relationship between cities and provinces. City: id city and province id 1 Guangzhou 12 Shenzhen 13 Huizhou 14 Changsha 25 Wuhan 3 .......................................................................................................................? (2) Display fields: city id, city name and province. For example: Id (city id) Cityname (city name) Privacy (privacy). . . . . . . . . . . . . . . . . . (2) If you want to count how many cities there are in each province, please use group by to find out. ? Display fields: province id, province name and number of cities included. Answer: 1.select A.id, A.Cityname, B.Province from city A, province b where a.province id = b.id2.select b.id, B.Province, Count(*) as num from city A, province ID = b.id group by b.id12. Please briefly describe the steps of software development in software engineering according to your experience. Used tools include Rational Rose, PowerDesigner, Project, VSS or CVS, TestDirector, etc. What are their shortcomings? The company uses dbdesigner and cvs, and the test management tool is Mantis 13. Please briefly describe the difference between threads and processes in the operating system. List the software you have used under LINUX? 14. Please sort the following set of data with pseudo-language and bubble sorting method of data structure10236141025 23 85 99 45. Function bubble _ sort (&; $ arr){ $ number = count($ arr); for($ I = 0; $ i & lt$ number- 1; $ i++){ for($ j = 0; $ j & lt$ number- 1-$ I; $ j++){ if($ arr[$ j]& gt; $ 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 "& ltpre & gt"; var _ dump($ arr); [/php]
- Previous article:What bank's SMS number is 955580 1?
- Next article:Discussion on "Advantages and Disadvantages of Establishing a Private Law Firm"
- Related articles
- Send a message to my boyfriend's parents wishing them a happy Lantern Festival.
- Is there a monthly fee for SMS storage? Where should I go to handle it?
- I have received a lot of invitation messages recently. Is it a virus of Android phone?
- Why didn't I get an interview notice, but I received an interview invitation in the mailbox, and I can't remember what I voted for?
- May 1 ST safe travel slogan
- Can my wife play mobile phone when she is pregnant?
- What is the end of life and death? Introduction to Life-and-Death Dependence Diversity Story
- Greetings from the tiger
- I want to start with one plus five recently. How about the quality?
- Have you ever been called? What do you know about the collection industry?