PHP经典笔试题

时间:2018-12-31 12:00:00 资料大全 我要投稿

PHP经典笔试题

  1 请说明 PHP 中传值与传引用的区别,

PHP经典笔试题

。什么时候传值什么时候传引用?

PHP经典笔试题

  答: 传值只是把某一个变量的.值传给了另一个变量,而引用则说明两者指向了同一个地方。

  2 在PHP中error_reporting这个函数有什么作用?

  答: The error_reporting() function sets the error_reporting directive at runtime. PHP has many levels of errors, using this function sets that level for the duration (runtime) of your script.

  3 请用正则表达式(Regular Expression)写一个函数验证电子邮件的格式是否正确。

  答:

  php

  if(isset($_POST['action']) &&

  $_POST['action']==’submitted’)

  {

  $email=$_POST['email'];

  if(!preg_match(“/^(?:w+.?)*w+@(?:w+.?)*w+$/”,$email))

  {

  echo

  “电子邮件检测失败”;

  }

  else

  {

  echo

  “电子邮件检测成功”;

  }

  }

  else

  {

  ?>

【PHP经典笔试题】相关文章:

1.经典PHP笔试题

2.PHP笔试题

3.PHP基础笔试题

4.几道PHP笔试题

5.笔试题:ASP与PHP

6.PHP笔试题含答案

7.PHP笔试题及答案

8.Yahoo-PHP笔试题