search
Homephp教程php手册PHP面试题及答案,php试题及答案

PHP面试题及答案,php试题及答案

1.请写一个函数,实现以下功能:
字符串"open_door"转换成 "OpenDoor"、"make_by_id" 转换成"MakeById"。
function str_change($str) {
$str = str_replace ( "_", " ", $str );
$str = ucwords ( $str );
$str = str_replace ( " ", "", $str );
return $str; }

2. 要求写一段程序,实现以下数组$arr1转换成数组$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 "

";<br>var_dump($arr2);<br>?>
<p>3. 请简述数据库设计的范式及应用。<br>一般第3范式就足以,用于表结构的优化,这样做既可以避免应用程序过于复杂同时也避免了SQL语句过于庞大所造成系统效率低下。<br>ANSWER:<br>第一范式:若关系模式R的每一个属性是不可再分解的,再属于第一范式。<br>第二范式:若R属于第一范式,且所有的非码属性都完全函数依赖于码属性,则为第二范式。<br>第三范式:若R属于第二范式,且所有的非码属性没有一个是传递函数依赖于候选码,则属于第三范式。</p>
Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools