Home > Backend Development > PHP Tutorial > PHP interview questions and answers, PHP test questions and answers_PHP tutorial

PHP interview questions and answers, PHP test questions and answers_PHP tutorial

WBOY
Release: 2016-07-13 09:44:27
Original
1308 people have browsed it

PHP interview questions and answers, PHP test questions and answers

1. Please write a function to achieve the following functions:
Convert the string "open_door" into "OpenDoor", "make_by_id" is converted to "MakeById".
function str_change($str) {
$str = str_replace ( "_", " ", $str );
$str = ucwords ( $str );
$str = str_replace ( " ", "", $str );
return $str; }

2. It is required to write a program to convert the following array $arr1 into array $arr2:
$arr1 = array (
'0' => array ('fid' => 1, 'tid ' => 1, 'name' =>'Name1' ),
'1' => array ('fid' => 1, 'ti' => 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')
);
$arr2 = 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′ ) ) );

$arr1 = array (
'0' => array ('fid' => 1, 'tid' => , '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);
}
$arr2=changeArrayStyle($arr1);
echo "

";
var_dump($ arr2);
?>

3. Please briefly describe the paradigm and application of database design.
Generally, the 3rd normal form is sufficient for optimizing the table structure. This can not only avoid the application being too complex, but also avoid the inefficiency of the system caused by too large SQL statements.
ANSWER:
First normal form: If each attribute of the relational pattern R cannot be decomposed, it belongs to the first normal form.
Second normal form: If R belongs to the first normal form and all non-code attributes are completely functionally dependent on the code attributes, it is in the second normal form.
Third normal form: If R belongs to the second normal form, and none of the non-code attributes is a transfer function that depends on the candidate code, then it belongs to the third normal form.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1048767.htmlTechArticlePHP interview questions and answers, PHP test questions and answers 1. Please write a function to achieve the following functions: String" open_door" is converted to "OpenDoor", "make_by_id" is converted to "MakeById". function str_...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template