index...
Transcript of index...
855
Index
Symbols& (ampersand), 211&& (AND operator), 608`` (backquotes/backticks), 143& (bitwise AND) operator, 140~ (bitwise NOT) operator, 141| (bitwise OR) operator, 140^ (bitwise XOR) operator, 140^ (caret metacharacter), 518, 520–521" (double quote), 211@ (error control) operator, 143–145> (greater than), 211, 608, 611-612<< (left shift) operator, 141< (less than), 211, 608, 611-612* metacharacter, 536–538!, NOT operator, 608< operator, 608, 611–612<= operator, 608<>, != operator, 608–609= operator, 608–609> operator, 608, 611–612-> operator, 743–744>= operator, 608|| (OR operator), 130–132, 608>> (right shift) operator, 141' (single quote), 211, 352–353, 609% wildcard, 613–614>>> (zero-fill right shift) operator,
141
Aabs() function, 117Access methods, 53, 758–760ACTION attribute, 91action attribute, 389–390, 421addcslashes() function, 206–208, 214Addition (+), 112addslashes() function, 206–208, 214admin_art_edit.php, 784, 793–796admin_art_list.php, 784admin_artist_edit.php, 784, 788–789admin_artist_insert.php, 784, 791–792admin_artist_list.php, 784, 786–787,
796admin_footer.php, 784admin_header.php, 784, 803admin_login.php, 784, 797, 803Advisory locking, 474Aliases, 630–631Alphabetic sort of, 299–300Alphanumeric word characters, metasymbols
representing, 531–533ALTER command, 631ALTER TABLE statement, 620, 631–633Alternation, metacharacters for, 543Anchoring metacharacters, 520–523
beginning-of-line anchor, 520–523end-of-line anchor, 522word boundaries, 523
index.fm Page 855 Wednesday, October 25, 2006 1:28 PM
856 Index
AND operator, 612–613&& (and) operator, 127–128
compared to using the word AND, 132Apache Web server, 14, 834
configuring to use PHP module (all platforms), 851–852
installing on Windows, 849–850testing installation, 852
Appending to files, 473–474Application Programming Interface (API), 5area.php, 146Arguments, 27, 29, 339, See also Passing
argumentsdefined, 341missing, 344–345names of, 341–342passing, 341–351variable number of, 345–347
Arithmetic operators, 112–113array() function, 251–252, 330(array) operator, 119array_change_key_case() function, 333array_chunk() function, 332array_combine() function, 251array_count_values() function, 278–279,
333array_diff() function, 333array_diff_assoc() function, 333array_diff_key() function, 333array_diff_ukey() function, 333array_diff_unassoc() function, 333array_fill() function, 251, 255–256, 330array_filter() function, 332array_flip() function, 332array_intersect() function, 334array_intersect_assoc() function, 334array_intersect_key() function, 334array_intersect_uassoc() function, 334array_intersect_ukey() function, 334array_key_exists() function, 331array_keys() function, 281–282, 331array_map() function, 332, 359, 359–360array_merge() function, 323, 325, 331array_merge_recursive() function, 326,
331
array_multisort() function, 298, 334array_pad() function, 251array_pop() function, 311–312, 332array_product() function, 332array_push() function, 315, 317–318, 332array_rand() function, 306, 310, 332array_reduce() function, 332array_reverse() function, 332array_search() function, 333array_shift() function, 311, 313, 332array_slice() function, 320–321, 332array_splice() function, 311, 315, 318–
321, 332array_sum() function, 331array_udiff() function, 333array_udiff_assoc() function, 333array_udiff_uassoc() function, 333array_uintersect() function, 334array_uintersect_assoc() function,
334array_uintersect_uassoc() function,
334array_unique() function, 314–315, 332array_unshift() function, 315–316, 332array_values() function, 283–284, 331,
333array_walk() function, 332array_walk_recursive() function, 332,
360Arrays, 46, 95, 247–335
accessing an array’s elements (values), 257–262
alphabetic sort, 299–300array() function, 251–252, 330array identifier [ ], 252–253array_combine() function, 251array_count_values() function, 278–
279, 333array_fill() function, 251, 255–256,
330array_keys() function, 281–282, 331array_merge() function, 323, 325, 331array_pad() function, 251array_push() function, 315, 317–318,
332
index.fm Page 856 Wednesday, October 25, 2006 1:28 PM
Index 857
array_slice() function, 320–321, 332array_unshift() function, 315–316,
332array_values() function, 283–284, 331,
333associative, 248
elements of, 259–260merging, 325sort by key, 305–306sort by values, 302–303
checking for the existence of, 274–275combining/merging, 322–327compact() function, 251count() function, 278–279creating and naming, 251–256creating from strings, 275–277creating strings from, 275–277creating variables from array elements,
286–293defined, 247each() function, 284–285, 288, 331elements, 247
adding, 315–319copying, 320–321removing, 310–315
extract() function, 97, 288–293, 331, 398–399, 788
extracting keys and values from, 281–286finding the size of, 278–280functions, 330–335list() function, 286–288and loops, 266–273mixing elements in, 260–262modifying, 310–335multidimensional, 293–297numeric, 248
elements of, 257–258shuffling, 309–310
numeric sort, 300–301numerically indexed, merging, 323–324operators, 327–330
equality operator, 329–330identical operator, 329–330union operator, 327–328
printing, 262–266
print_r() function, 262–264var_dump() function, 265–266
randomizing, 306–310range() function, 251, 253–255removing, 310–315removing duplicate values from, 314–315reversed sort, 302sizeof() function, 277–279, 333sort by key, 305–306sort by values, 302–303
in reverse order, 303–304sorting, 298–306splicing, 318–321
arsort() function, 298, 303–304, 334Art gallery, building (example), See Canvas
Gallery Web projectartist_detail.php, 784, 798, 800–801AS keyword, 630ASCII character set, 125asort() function, 298, 334ASP, 14, 41asp_tags configuration option, 853Assignment operator, 107–108Assignment statement, defined, 108Associative arrays, 248
and extract() function, 288–293merging, 325sort by key, 305–306sort by values, 302–303
Associativity, 108–111rules of, for PHP operators, 110
Attributes, 52, 675, 740–741AUTH_TYPE, 98AUTO_INCREMENT attribute, 625Autoglobal arrays, 431Autoincrement and autodecrement operators,
115–117AVG() function, 634Axmark, David, 7
BBackquotes, 143Backslash (/), 62Backticks, 74, 143Base class, 763
index.fm Page 857 Wednesday, October 25, 2006 1:28 PM
858 Index
base_convert() function, 117basename() function, 485–486BBEdit, 15Beginning-of-line anchor, 520–523, 521Berners-Lee, Tim, 1, 3BETWEEN operator, 608, 615BIG5, 214BIG5-HKSCS, 214Binary operators, 107bindec() function, 117binhex() function, 214Bits, 140Bitwise operators, 140–143
shift operators, 141–142using, 140
Black box, See FunctionsBLOB data type, 622Block, 132(bool) operator, 119Boolean literals, 68Boolean values, 44break statement, 51, 239–243Browser:
and HTML forms, 380–383using to remove cookies, 693–694
Built-in constants, 103Built-in functions, PHP, 27–28, 69Bytes, 140, 149
CCallback functions, 358, 358–362
array_map() function, 359–360array_walk_recursive() function, 360defined, 358
Canvas Gallery Web project, 783–808administration pages, 786–788database, creating, 785–786files, 784installing, 805–808MySQL database, installing, 806–807PHP pages, editing, 808public pages, 797–803
artist_detail.php page, 798, 800–801
contact.php page, 802–803
header.php page, 797–798index.php page, 798–799
public/private pages, 783securing pages with login, 803–805Web site, creating, 785–805where to find the files for, 805
Capturing, 545–547Caret (^) metacharacter, 518, 520–521Carriage return, 24Case sensitivity, SQL commands, 599–600Case statement, 228Casting operators, 118–120C/C++, 41, 49ceil() function, 117CGI script, 2Character classes, 525–526Character list (charlist), 182, 512charset, 211CHAR(SIZE) data type, 622checkbox input type, 388, 406–407checkdate() function, 831–832chgrp() function, 447chmod() function, 447–448chop function, 167fn, 182, 214chown() function, 447chr() function, 205, 214chunk_split function, 214Chunks, 814Class constants, 774–775, 775Class members, 742__CLASS__, 103Classes, 52–53
accessor or instance methods (setters/getters), 758–760
class constants, 774–775constructors, 753–756creating, 746–747defined, 740destructors, 756–758encapsulation, 749–750functions for getting class information,
748–749information hiding, 749–750inheritance, 741, 763–766instantiating, 741–742
index.fm Page 858 Wednesday, October 25, 2006 1:28 PM
Index 859
magic methods, 753–762members, 742
and scope, 750–752methods, 742and objects, 740
difference between, 742overriding methods, 766–768properties, 742protected access, 768–771reusing, 776–780static members, 773–774working with, 741–772
Classes and objects, 52–54Client/server databases, 568Client/server model, 7clock.php, 354Clustering, 544, 544–545Codd, E.F. “Ted,” 595ColdFusion, 14Command, 597Command-line applications, defined, 32Command-line options, PHP, 34–35Comments, 25–27, 42Commercial license, MySQL, 570Common Gateway Interface (CGI), 2–3compact() function, 251Comparison operators, 122–126
equality, 122–123Composite data types, 59Concatenation, 120
defined, 120operators, 120–121and variables, 79–80
CONCAT(string1,string2,...) function, 637
Conditional operator, 49, 138–139Conditional returns, 353–355Conditionals, 46–48, 222–231
if/else branching construct, 222–225if/elseif construct, 225–227switch statement, 228–231
constant() function, 102Constants, 43, 62, 99–103, 774–775
built-in, 103constant() function, 102
creating with the define() function, 100–101
defined, 99–100magic, 102predefined, 102–103
__construct() method, 753Constructors, 753–756
and inheritance, 763–766contact.php, 784contact.php page, 802–803continue control statement, 239–243continue statement, 51Control statements, loops, 239–243Control string, 156convert_cyr_string function, 214convert_uudecode function, 214convert_uuencode function, 214converter() function, 377$_COOKIE global array, 678–681Cookie jar, 674Cookies, 673–736
attributes, 675–677buffering and HTTP headers, 689–693defined, 673–674deleting, 693–694domain name, 676expiration date, 676extending the life of, 688–689ingredients, 674–675magic cookie, 674name, 675output buffering and php.ini, 693path, 676and PHP, 677–694
$_COOKIE global array, 678–681serialization, 681–683setcookie() function, 677–678tracking visitors, 683–687
security, 677sessions without, 717–720starting a cookie-based session, 698–699turning off, 674use of term, 674using the browser to remove, 693–694
copy() function, 481–482
index.fm Page 859 Wednesday, October 25, 2006 1:28 PM
860 Index
count() function, 278–279, 296–297, 333COUNT() function, 634count_chars function, 214COUNT(expression) function, 634cp866, 213cp1251, 213cp1252, 214crc32 function, 214CREATE INDEX statement, 620CREATE TABLE statement, 620, 623, 663Cross joins, 628crypt function, 214curdate() function, 592CURDATE() function, 638Curly brace syntax, 200Current directory, changing/getting, 486–487current() function, 333CURTIME() function, 638
DData Definition Language (DDL), 620–633
altering a table, 631–632creating a key, 625–627
foreign keys, 627primary keys, 625–626
creating a table, 623–625creating the database, 620–621dropping a database, 633dropping a table, 633relations, 628–631
aliases, 630–631two tables with a common key, 628–
629using a fully qualified name and a dot
to join tables, 629–630SQL data types, 621–622
Data hiding, 750Data Manipulation Language (DML), 603–
620DELETE statement, 619–620INSERT command, 617–618SELECT command, 604–617
LIKE operator, 608, 613LIMIT, 606–607NOT LIKE operator, 608, 613
NULL, 609–611AND operator, 612–613BETWEEN operator, 615ORDER BY clause, 616–617pattern matching and the % wildcard,
613–614quotes, 609SELECT DISTINCT statement, 605–606selecting all columns, 605selecting specified columns, 604WHERE clause, 608–609
UPDATE command, 618–619Data types, 43, 59–70
Boolean literals, 68defined, 59numeric literals, 60special, 68–70SQL, 621–622string literals and quoting, 62–67
Database design, 575database() function, 592Database schema, 575Database tables, 601–603Database-driven Web site, example of
building, 663–670designing the database, 663–664example summary, 670listing all messages, 669–670posting a message page, 665–668
Databases, 567–570, See also Relational databases
client/server, 568connecting to, 575–581defined, 571dropping, 633graphical user tools, 579–581MySQL command-line options, 576–578relational, 570–575SQL (Structured Query Language), 568–
569talking to, 568–570
databook file, 466, 468data.txt, 520Date and time functions:
date and time parts, 641–642
index.fm Page 860 Wednesday, October 25, 2006 1:28 PM
Index 861
EXTRACT command, 641–642formatting the date and time, 639–641SQL, 638–642
DATE data type, 622date() function, 29, 31, 38, 73, 77, 819–
821, 829DATE_FORMAT() function, 639–641Date/time:
checkdate() function, 831–832date() function, 819–821, 829formatting dates and times, 819–824getdate() function, 829–830mktime() function, 825–827, 829and PHP, 819–832strftime() function, 822–824time() function, 824–825UNIX timestamp, 819
creating from a string, 828–829validating dates, 831–832
DATETIME data type, 622DAYNAME(date) function, 638DAYOFMONTH(date) function, 638DAYOFWEEK(date) function, 638DAYOFYEAR(date) function, 638db.sql, 784DDL, See Data Definition Language (DDL)Debugging, 841–847
diagnostic print statements, 843–845error reporting, turning on, 841parse errors, 841–842SQL errors, fixing, 845–847
decbin() function, 117dechex() function, 117DECIMAL(m,d) data type, 622Decision-making constructs, 222decoct() function, 117Default condition, 227define() function, 43, 100–101
creating constants with, 100–101DELETE statement, 619–620DESCRIBE command, 602–603, 664__destruct() method, 753, 757Destructors, 756–758Diagnostic print statements, 843–845
Digits and spaces, metasymbols representing, 530–531
Directories, 483–487current, changing and getting, 486–487opendir() function, 483–484path information, getting, 485–486readdir() function, 484–485
dirname() function, 485–486display_errors directive, 840, 853DISTINCT keyword, 605–606Division (/), 112DML, See Data Manipulation Language
(DML)DOCUMENT_ROOT, 98, 433Dot metacharacter, 524–525Double data type, 59Double word, 140DOUBLE(m,d) data type, 622Doubles, 60do-while loop, 49–50, 234drop command, 633drop database command, 633DROP INDEX statement, 620DROP TABLE statement, 620, 633, 664Drop-down lists, 387Dropping a database, 633Dropping a table, 633Dynamic function calls, 351Dynamic variable, 82Dynamic Web sites, 2–3
process of creating, 3
Eeach() function, 284–285, 288, 331eBay, 7echo() function, 42, 76, 215Edit distance, 177Element, 247emacs, 15E-mail, and PHP, 809–817empty() function, 88–89Encapsulation, 749–750enctype attribute, 421end() function, 334
index.fm Page 861 Wednesday, October 25, 2006 1:28 PM
862 Index
Ending sessions, 727–730End-of-line anchor, 522ENT_COMPAT, 211ENT_NOQUOTES, 211ENT_QUOTES, 211Environment variables, 84, 437–438Epoch, 819Equality, 122–123Equality operator, arrays, 329–330ereg() function, 499ereg_replace() function, 499eregi() function, 499eregi_replace() function, 499Error control operators, 143–145Error reporting settings, 839–840error_log directive, 841error_reporting directive, 839–840, 853Escape sequences, 62, 66–67EUC-JP, 214Exclusive OR operator, 134Execution operators, 143Expiration date, cookies, 676explode() function, 179, 215, 275, 276–
277, 331, 466–467, 510Expressions:
defined, 107testing with logical operators, 126–127
extension_dir configuration option, 854EXTR_IF_EXISTS, 289EXTR_OVERWRITE, 289EXTR_PREFIX_ALL, 289, 292EXTR_PREFIX_IF_EXISTS, 289EXTR_PREFIX_INVALID, 290EXTR_PREFIX_SAME, 290EXTR_REFS, 290EXTR_SKIP, 290–291extract() function, 97, 288–293, 331, 398–
399, 788and associative arrays, 288–293
FFALSE, 103fclose() function, 450, 474feof() function, 450, 451fflush() function, 450
fgetc() function, 450, 455–456fgets() function, 450, 451–452fgetscsv() function, 450fgetss() function, 450, 453–454Fibonacci, Leonardo, 370Fibonacci sequence, 370Fields, 567, 572–573, 601File checks, 475–481file() function, 450, 465–466file input type, 389File pointer, 441, 448
positioning, 458–462__FILE__, 103file_exists() function, 450, 451, 476–
477file_get_contents() function, 450, 464–
465file_put_contents() function, 472Files, 54–55, 441–446
appending to, 473–474chgrp() function, 447chmod() function, 447–448chown() function, 447filehandle, 448fopen() function, 448–450locking implications, 474–475opening, 448–450
for reading, 451–458for writing/appending, 471–475
opening a URL for reading, 463–464useful file functions, 450without a filehandle, reading from, 464–
465final classes and methods, 772–773Firefox, 14Flat files, 441(float) operator, 119Floating-point numbers, 60FLOAT(m,d) data type, 622flock() function, 474–475floor() function, 117Flow chart, defined, 221footer.php, 784fopen() function, 448–450, 471, 474
defined, 450
index.fm Page 862 Wednesday, October 25, 2006 1:28 PM
Index 863
modes for, 449–450for loop, 50, 235–238
and repetitive form fields, 236foreach loop, 50–51, 239Foreign key, 627–628Form validation with PHP, 556–562
regular expressions used for (table), 557valid e-mail address, checking for, 557–
562Form variables, 90–99
extracting data by request, 95–97how PHP handles form input, 91–95php.ini file and register_globals,
90–91predefined variables, 98–99
fprintf() function, 20, 42, 160, 215fputs() function, 472fread() function, 456–458Free form language, defined, 23–24Free Software Foundation, 3fseek() function, 459–460ftell() function, 461–462Full joins, 628func_get_arg($arg_num) function, 345–
347func_get_args() function, 345–347func_num_args() function, 345–347function construct, 52function keyword, 338–339Function libraries, 373–376
include() construct, 373–375require() construct, 373–375
__FUNCTION__, 103Functions, 52
compared to miniscripts, 338declaring, 338defined, 52, 337definition, 338how to call, 339–341how to define, 338–339naming conventions, 339nesting, 368–370recursive, 370–372
fwrite() function, 472
Ggallerydb.sql, 784Garbage collection, 729–730GATEWAY_INTERFACE, 432GB2312, 214gc_maxlifetime configuration directive,
729–730GET method, 381–382$_GET array, 400–402__get() method, 753, 758get_class() function, 744–745, 748–749get_class_vars() function, 748–749get_declared_classes() function, 748–
749get_html_translation_table function,
215get_magic_quotes_gpc() function, 206get_object_vars() function, 748–749get_parent_class() function, 748–749getrandmax() function, 117Getters, 758–760gettype() function, 69–70, 73, 277, 744–
745, 748–749global command, 52Global scope, 363–364Global variables, 84GoDaddy, 834Google, 2Grant tables, 582Greed factor, 534–535Greedy match, 534Greedy metacharacters, 533–534
* metacharacter, 536–538+ metacharacter, 539
Grouping/clustering, 544–545Gutmans, Andi, 4
HHaystack, 192, 198header() function, 417–418header.php, 784, 797–798hebrev function, 215hebrevc function, 215Helper program, 2
index.fm Page 863 Wednesday, October 25, 2006 1:28 PM
864 Index
Here-documents (here-docs), 62, 64rules for, 64–65
hexdec() function, 118Hidden fields, using, 415–417hidden input type, 389Homophones, 175House class, 740–742htdocs, 384HTML forms:
$_REQUEST array:extract() function, 398–399form parameters in, 396–399
action attribute, 389–390browser’s role, 380–383creating, 384–390dots and spaces in html input device
names, 393–394form input types, 388–389form parameters and the medium style,
400–405$_GET array, 400–402$_POST array, 403–405security, 402
GET method, 381–382image button, 410–412method attribute, 389POST method, 382–383processing forms with multiple selections,
406–409creating the form with select and check
boxes, 406–408processing the form with multiple
selections, 408–409request method, 393review of, 379–390self-processing, 413–420server information, how to get, 432–436server’s role, 383–384slashes, stripping out, 395–396steps in producing, 385–386sticky forms, 427–431superglobal arrays, where to get
information about, 431–432uploading files, 421–427
HTML (Hypertext Markup Language), 1–2compared to PHP, 21–23
HTML special characters, 210–214html_entity_decode function, 215htmlentities() function, 210, 213–214,
215htmlspecialchars() function, 210, 210–
215htmlspecialchars_decode(), 210–215HTTP (Hypertext Transfer Protocol), 1, 14,
379, 673Set-Cookie header, 675
HTTP request methods, 381HTTP_ACCEPT, 433HTTP_CONNECTION, 433HTTP_HOST, 433HTTP_REFERER, 98, 433HTTP_USER_AGENT, 98, 433$_HTTP_COOKIE_VARS, 392httpd.conf, 18fn$_HTTP_ENV_VARS, 392$_HTTP_GET_VARS, 392$_HTTP_POST_VARS, 392$_HTTP_POST_FILES, 392$_HTTP_SERVER_VARS, 392
IIdentical operator, arrays, 329–330Identity test, with strings and numbers, 123if statement, 46if/else branching construct, 222–225if/elseif construct, 47, 225–227Image button, 410–412image input type, 389Image map, 410implode() function, 179, 215, 275–276,
331, 466–467in_array() function, 331include() construct, 100, 373–375, 487–
488include_path directive, php.ini
configuration file, 487Index, 247Index position of the substring, 189
index.fm Page 864 Wednesday, October 25, 2006 1:28 PM
Index 865
index.php, 784, 798–799INFO_ALL, 432INFO_CONFIGURATION, 432INFO_CREDITS, 432INFO_ENVIRONMENT, 432INFO_GENERAL, 432INFO_LICENSE, 432INFO_MODULES, 432INFO_VARIABLES, 432Information hiding, 749–750Ingres, 595Inheritance, 741, 763–766
and constructors, 763–766defined, 763
Inner joins, 628INSERT command, 617–618Instance methods, 53instanceof (PHP 5) function, 748–749(int) operator, 119INT UNSIGNED data type, 622INTEGER data type, 622Integers, 60interface_exists() function, 748–749Internet Explorer, 14Internet Information Services (IIS), 14Interpreter, 15Invocation, 338IS [NOT] NULL operator, 608is_a() function, 748–749is_array() function, 331is_dir(), 476is_file(), 476is_file() function, 477–478is_finite() function, 118is_infinite() function, 118is_link(), 476is_nan() function, 118is_readable() function, 451, 476, 478is_subclass_of() function, 748–749is_uploaded_file(), 476is_writeable(), 476, 479ISO-8859-1, 213ISO-8859-15, 213isset() function, 85–87, 340
JJava, 41JavaScript, 64Join, 628join() function, 275, 331, 628Joins, 628
Kkey() function, 331Keys, randomizing, 306KOI8-R, 214krsort() function, 298, 334ksort() function, 298, 305, 334
LLabels, 228Left joins, 628Lerdorf, Rasmus, 4levenshtein() function, 176–178, 215Library, 373Lifetime, 362LIKE operator, 608, 613LIMIT clause, 606–607, 619Line breaks, 23–24__LINE__, 103list() function, 331 and numeric arrays, 286–288Literals, 62, 64Local scope, 362–363Local variables, 84localeconv function, 215LOCK_EX, 474LOCK_NB, 474LOCK_SH, 474LOCK_UN, 474log_errors directive, 841Logical AND operator, 127, 127–128
examples, 128Logical operators, 126–137
&& (and) operator, 127|| (or) operator, 130–132logical XOR operator, 134–135NOT (!) operator, 135–137testing expressions with, 126–127
index.fm Page 865 Wednesday, October 25, 2006 1:28 PM
866 Index
Logical OR operator, 130–132examples, 130–131
Logical XOR operator, 134–135examples, 134
Lookahead, 550–551, 551Loop control, 51Looping constructs, 222Loops, 49–51, 232–243
and arrays, 266–273break control statement, 239–243continue control statement, 239–243control statements, 239–243do/while loop, 234foreach loop, 239for loop, 235–238
and repetitive form fields, 236nested loops, 241–243while loop, 232–233
LOWER(string) function, 637ltrim() function, 167fn, 182, 215
MMagic constants, 102Magic cookie, 674magic_quotes_gpc directive, 206, 395, 853MagicCookie file, 674mail() function, 811Markup language, defined, 21Mask, 173Math functions, 117–118max() function, 118MAX() function, 634mb_convert_case() function, 165–167md5 function, 215md5_file function, 215Members, classes, 742
and scope, 750–752Metacharacters, 517–554, See also Anchoring
metacharactersfor alternation, 543anchors (assertions), 520–523character classes, 525–526dot metacharacter, 524–525greedy, 533–534
matching one character from a set, 526–527
matching one character in a range, 527–528
matching one character not in a set, 529metasymbols, 530–533to repeat pattern matches, 533–544table of, 518–519turning off greed, 541–542
metaphone() function, 174–176, 215Metasymbols, 526, 530–533, 533
representing alphanumeric word characters, 531–533
representing digits and spaces, 530–531METHOD attribute, 91method attribute, 389, 421__METHOD__, 103method_exists() function, 748–749Methods, 52, 338, 740–741, 745, 747
classes, 742defined, 743
Microsoft Internet Information Server, 834Microsoft SQL Server, 595min() function, 118MIN() function, 634Missing arguments, 344–345Mixed data types, and variables, 78–79mktime() function, 689, 829Modulus operator, 114money_format() function, 162, 216MONTHNAME(date) function, 638move_uploaded_file() function, 425Multidimensional arrays, 293–297
finding the size of, 296–297Multipart MIME message, 810, 814Multiple alternative delimiters, splitting on,
512–515Multiple-line comments, 25Multiplication (*), 112Multiplier, 181mylibrary.php, 373MySQL, 3, 7–8, 14, 834
advantages of, 9–10choosing the database, 649–650
index.fm Page 866 Wednesday, October 25, 2006 1:28 PM
Index 867
client/server model, 7command-line options, 576–578commercial license, 569–570community of developers, 569connecting to the database server, 647–
649database-driven Web site, example of
building, 663–670designing the database, 663–664example summary, 670listing all messages, 669–670posting a message page, 665–668
databases, 567–570defined, 7developers, 10documentation, 7Documentation page, 8ease of learning, 10ease of use, 569executing SQL statements (INSERT,
UPDATE, DELETE), 650–652extensibility, 10features, 7–8GPL (GNU General Public License), 9installing, 9installing on Linux/UNIX, 854installing on Mac OS X, 854installing on Windows, 854low cost, 10open source license, 569open source software, 9performance, 9portability, 10privilege system, 582–593
creating and dropping a database, 590–591
“db” table, 586–587finding the databases, 583–585GRANT command, 589–590“host” table, 587–588logging into the database server, 582–
583primary purpose of, 582real-world example, 588–589REVOKE command, 589–590
useful functions, 592–593“user” table, 585–586
query results, retrieving, 653–657mysql_fetch_assoc() function, 655–
657mysql_fetch_row() function, 653–
655scalability, 570strengths/weaknesses, 569–570terminology, 583where to get, 7
MySQL AB, 7mysql console, 596MySQL Query Browser, 580–581, 596, 597,
806mysql_affected_rows() function, 657mysql_change_user() function, 657mysql_connect() function, 657mysql_errno() function, 658mysql_error() function, 658–659mysql_fetch_assoc() function, 657mysql_fetch_assoc() function, 655–657mysql_fetch_field() function, 658mysql_fetch_object() function, 658mysql_fetch_row() function, 653–655,
657mysql_field_len() function, 658mysql_field_name() function, 658, 661–
662mysql_field_seek() function, 658mysql_field_table() function, 658mysql_field_type() function, 658mysql_list_dbs function, 657mysql_list_fields() function, 658mysql_list_tables function, 657mysql_num_fields() function, 658, 661mysql_num_rows() function, 658, 660mysql_pconnect() function, 657mysql_selectdb() function, 657mysql_tablename() function, 658
NNaming conventions, functions, 339Naming sessions, 715–717natcasesort() function, 298, 334
index.fm Page 867 Wednesday, October 25, 2006 1:28 PM
868 Index
natsort() function, 298, 334Needle, 192Nested function, 368–370Nested loops, 241–243 Netscape, 14, 674Network security, and SSL, 833–834new keyword, 742Newline (line feed), 24next() function, 334nl_langinfo function, 215nl2br() function, 200–202, 215Noncapturing parentheses, 519Nonprogrammer notes, 41–42NOT (!) operator, 135–137NOT LIKE operator, 608, 613! operator, 135–137Notepad, 15now() function, 592NOW() function, 638Nul-byte, 24NULL, 68null() function, 85–86Null string, 62Null value, 45number_format() function, 160, 161–162,
215Numbers, 43
comparing, 124equality test with, 123identity test with, 123
Numeric arrays, 248and list() function, 286–288shuffling, 309–310
Numeric functions, SQL, 634–636GROUP BY clause, 635–636
Numeric literals, 60Numeric sort, 300–301Numerically indexed arrays:
alphabetic sort of, 299–300merging, 323–324numeric sort, 300–301
NUMERIC(m,d) data type, 622
Oob_end_flush() function, 691–692
ob_start() function, 691–692Object-oriented programming (OOP), 739–
740encapsulation and information hiding, 750
Objects, 52–53, 739–781and classes, 740
difference between, 742defined, 739displaying, 747–748properties, 740
octdec() function, 118Offset, 318Open source license, MySQL, 570Open Source movement, 3–4Opening files, 448–450
mode and permissions, 449–450for reading, 451–458for writing/appending, 471–475
Operands, 79, 107–108defined, 107
Operators, 45, 107–108arithmetic, 112–113arrays, 327–330assignment, 107–108associativity, 108–111autoincrement and autodecrement, 115–
117bitwise, 140–143casting, 118–120comparison, 122–126concatenation, 120–121conditional, 138–139defined, 107error control, 143–145execution, 143logical, 126–137precedence, 108–111short circuit assignment, 113–114SQL, 608type, 145
Oracle, 14, 595ord() function, 206, 215ORDER BY clause, 616–617, 619Overriding methods, 766–768
index.fm Page 868 Wednesday, October 25, 2006 1:28 PM
Index 869
Ppages.php, 494Parent class, 763Parent function, 368Parent–child relationship, 763Parse errors, 841–843parse_str function, 215Passing arguments, 341–351
default parameters, setting, 347–348dynamic function calls, 351missing arguments, 344–345by reference, 349–351by value, 342–344
password() function, 592password input type, 388Path, cookies, 676PATH_TRANSLATED, 434Pattern, finding, 500–503
captured patterns, 502–503case sensitivity, 501–502
Pattern matching, 499–565evaluating the replacement side with the e
modifier, 509–510functions, 499–517modifiers, 505–506multiple alternative delimiters, splitting
on, 512–515preg_grep() function, 515–517preg_match() function, 499, 503–504preg_match_all() function, 499, 503–
504preg_split() function, 179, 499, 510–
511flags for, 511
searching and replacing, preg_replace_callback() function, 499, 506–509
searching for patterns in text files, 554–556
Patterns, searching for, in text files, 554–556PCRE (Perl Compatible Regular Expression)
library, 498Period (.) metacharacter, 518Perl, 2, 10, 41, 64Perl style, regular expressions, 498
Permissions, 446PHP, 2–3, 14
advantages of, 9–10built-in functions, 10, 27–28on the command line, 32command-line options, 34–35comments, 25–27compared to HTML, 21–23and cookies, 677–694
$_COOKIE global array, 678–681serialization, 681–683setcookie() function, 677–678tracking visitors, 683–687
and date/time, 819–832defined, 4developers, 10documentation, 5–6download page, 6ease of learning, 10and e-mail, 809–817
chunks, 814mail() function, 811mail server, 809MIME (Multipurpose Internet Mail
Extensions), 810runtime configuration options, 810sending a message with an attachment,
814–817sending a simple message, 811–812sending an HTML message, 813–817Simple Mail Transfer Protocol (SMTP)
server, 809extensibility, 10finding the version of, 32form validation with, 556–562and forms, 390–438
superglobals for retrieving form data, 392
as hypertext preprocessor, 15installing, 9installing on Linux/UNIX, 851installing on Mac OS X, 851installing on Windows, 850–851latest release of, 5line breaks, 23–24
index.fm Page 869 Wednesday, October 25, 2006 1:28 PM
870 Index
PHP (continued):low cost, 10and MySQL integration, 647–672performance, 9php.ini file, 35–37portability, 10quick start, 41–57running interactively, 34script execution at the command line, 32–
33sessions, 694statements, 23–24syntax and constructs, 42–56testing installation, 852where to get, 5–6whitespace, 23–24
PHP expressions, 107, See also ExpressionsPHP operators, 107, See also OperatorsPHP regular expressions, See Regular
expressionsPHP script:
anatomy of, 15–21executing, 20.php extension, 16printing strings, 20quoting in strings, 19script content, 18steps of writing, 15tags, 16–17text editor, finding, 15where to save, 18
PHP Security Consortium (PHPSC), 841PHP superglobal arrays, 431PHP syntax and constructs:
arrays, 46Boolean values, 44classes and objects, 52–54comments, 42conditional operator, 49conditionals, 46–48constants, 43data types, 43files, 54–55functions, 52loop control, 51
loops, 49–51null value, 45numbers, 43operators, 45predefined variables, 43printing output, 42quotes, 44regular expressions, 55–56
metacharacters, 56strings, 44tags, 42variables, 43
PHP_OS, 103PHP_SELF, 432PHP_VERSION, 103PHP/FI (Personal Home page/Forms
Interpreter), 4php.info() file, 76phpinfo() function, 38, 76, 98–99, 431–
432, 498, 852php.ini, 17, 35–37, 76, 90
configuring, 853–854phpMyAdmin tool, 579–580php.net, 5–6pi() function, 118pico, 15Portmanteau, defined, 4fnpos() function, 333Positive lookahead, 550–551Positive lookbehind, 552POSIX style, regular expressions, 498POST method, 382–383$_POST array, 403–405Postincrement operator, 115–116pow() function, 118Precedence, 108–111
rules of, for PHP operators, 110Predefined constants, 102–103Predefined variables, 43, 98–99preg_grep() function, 499, 515–517preg_match() function, 499, 500–501,
503–504preg_match_all() function, 499, 503–504preg_quote() function, 499preg_replace() function, 499
index.fm Page 870 Wednesday, October 25, 2006 1:28 PM
Index 871
preg_replace_callback() function, 499, 506–509
preg_split() function, 179, 499, 510–511flags for, 511
PREG_SPLIT_DELIM_CAPTURE, 511PREG_SPLIT_NO_EMPTY, 511PREG_SPLIT_OFFSET_CAPTURE, 511Preincrement operator, 115–116prev() function, 334Primary keys, 625–626print() function, 19, 42, 77, 80, 216print_r() function, 262–264, 330printf() function, 42, 147, 156–159, 162,
216format specifier modifiers, 159format specifiers, 158
Printing output, 42Private scope, 750Privilege system, MySQL, 582–593
creating and dropping a database, 590–591“db” table, 586–587finding the databases, 583–585GRANT command, 589–590“host” table, 587–588logging into the database server, 582–583primary purpose of, 582real-world example, 588–589REVOKE command, 589–590useful functions, 592–593“user” table, 585–586
Properties, 52, 740, 745, 746classes, 742objects, 740
property_exists() function, 748–749Proprietary software, examples of, 3fnProtected access, 768–771Protected scope, 751public keyword, 742Public scope, 750
QQuantifiers, 533QUARTER(date) function, 638Queries, 567, 568, 595Query results, retrieving in SQL, 653–657
mysql_fetch_assoc() function, 655–657
mysql_fetch_row() function, 653–655Query string, 91, 382QUERY_STRING, 433quoted_printable_decode function, 216quotemeta function, 216Quotes, 44, 609
strings, 150–152
Rradio input type, 389rand(start,finish) function, 118range() function, 251, 253–255, 330readfile() function, 470Reals, 60Records, 601Recursion, 296Recursive functions, 370–372Redirection, using the correct URI for, 418–
420register_globals directive, 90, 391, 835–
837, 853Regular expressions, 55–56, 497, 497–565,
See also Pattern matchingcommenting, and the x modifier, 553–554defined, 497–498grouping/clustering, 544–545metacharacters, 56, 517–554Perl style, 498positive lookahead, 550–551positive lookbehind, 552POSIX style, 498regexlib.com, 562–564remembering/capturing, 545–547searching, capturing, and replacing, 548–
550Relation, 567Relational databases, 570–575
columns/fields, 573database schema, 575databases, defined, 571fields, 572–573indexes, 574primary key, 574
index.fm Page 871 Wednesday, October 25, 2006 1:28 PM
872 Index
Relational databases (continued):records, 572–573rows/records, 574tables, 571–572
Relations, 567, 628–631aliases, 630–631two tables with a common key, 628–629using a fully qualified name and a dot to
join tables, 629–630Remembering/capturing, 545–547REMOTE ADDRESS, 98REMOTE_ADDR, 433REMOTE_HOST, 433REMOTE_PORT, 433rename() function, 481–482Repeating characters, matching for, 540–541request method, 393$_REQUEST[] superglobal array, 836REQUEST_METHOD, 433REQUEST_TIME, 433REQUEST_URI, 434Request/response loop, 14require() construct, 373–375, 487–488Reserved words, SQL, 599reset() function, 284, 334reset input type, 389Resources, 68Result-set, 604Return values, 27, 351–358
conditional returns, 353–355returning a single value, 352–353returning multiple values, 355–358
Reusing classes, 776–780Reversed sort, 302rewind() function, 459round() function, 27, 118rsort() function, 298, 302, 334rtrim() function, 167fn, 182, 216Runtime configuration, sessions, 730–731
SSambar, 14Scalability, MySQL, 570Scalar variable, 247
defined, 247
Scalars, 59Scope, 362–367
$GLOBALS[] array, 365global, 363–364local, 362–363private, 750protected, 751public, 750static variables, 365–367
SCRIPT_FILENAME, 434SCRIPT_NAME, 434Secure Sockets Layer (SSL), 833–834Security, 833–841
cookies, 677defined, 833error reporting settings, 839–840file names, 838file system, 839form field validation, 835logging everything, 839network security and SSL, 833–834operating system, web server, and file
system security, 834–835PHP and MySQL, 834–835PHP Security Consortium (PHPSC), 841register_globals directive, 835–837safe mode, 839SQL injections, 837
seek() function, 459SELECT * FROM command, 601SELECT command, 604–617
< operator, 611–612<>, != operator, 608–609= operator, 608–609> operator, 611–612LIKE operator, 608, 613LIMIT clause, 606–607NOT LIKE operator, 608, 613NULL, 609–611AND operator, 612–613BETWEEN operator, 615ORDER BY clause, 616–617pattern matching and the % wildcard, 613–
614quotes, 609
index.fm Page 872 Wednesday, October 25, 2006 1:28 PM
Index 873
SELECT DISTINCT statement, 605–606selecting all columns, 605selecting specified columns, 604WHERE clause, 608, 608–609
SELECT DISTINCT statement, 605–606select input type, 389, 406–407Selection criteria, 608Self-processing HTML forms, 413–420
checking for form submission, 413–414hidden fields, using, 415–417redirecting the user, 417–420
location header, 417–418using the correct URL for redirection,
418–420SEQUEL (Structured English Query
Language), 595Serialization, 681–683serialize() function, 681–682SERVER_NAME, 433SERVER_PORT, 434SERVER_PROTOCOL, 433SERVER_SIGNATURE, 434SERVER_SOFTWARE, 433$_SERVER array, 432–436Session ID number, 695session_cache_expire() function, 730session_cache_limiter() function, 730session_commit() function, 730session_decode() function, 730session_destroy() function, 727–729,
730session_encode() function, 730session_get_cookie_params() function,
730session_id() function, 730session_is_registered() function, 702,
730session_module_name() function, 731session_name() function, 715, 731session_regenerate_id() function, 731session_register() function, 702, 731session_save_path() function, 731session_set_cookie_params() function,
731
session_set_save_handler() function, 731
session_start() function, 698–699, 715, 731
session_unregister() function, 702, 731session_unset() function, 731session_write_close() function, 728,
731$_SESSION array, 702–706session.cookie_domain directive, 707session.cookie_lifetime directive, 707session.cookie_path directive, 707session.cookie_secure directive, 707Sessions, 673, 694–736
defined, 694ending, 727–730garbage collection, 729–730hidden form element, 717–720implementing a login system with, 731–
736naming, 715–717registering, 699–702runtime configuration, 730–731saving arrays in, 702–706session cookie functions and configuration
options, 706–707session files, cleaning up, 729–730session IDs:
changing, 726–727passing with a link, 721–726
session variables, deleting, 727–728session_register() function, 702session_start() function, 698–699setting preferences with, 708–715starting a cookie-based session, 698–699where to store, 696–698without cookies, 717–720
session.save_path() function, 696session.use_cookies directive, 707session.use_only_cookies directive, 707__set() method, 753, 758setcookie() function, 677–678, 681–682,
727setlocale function, 216
index.fm Page 873 Wednesday, October 25, 2006 1:28 PM
874 Index
Setters, 758–760sha1 function, 216sha1_file function, 216Shell terminal, 33shell_exec() function, 143Shift_JIS, 214Short circuit assignment operators, 113–114short_open_tag configuration option, 853SHOW FIELDS IN command, 602–603SHOW TABLES IN command, 601ShowDate.php, 33shuffle() function, 298, 309–310, 332, 335similar_text function, 216similar_text() function, 176–178Simple Mail Transfer Protocol (SMTP) server,
809Single quotes, 150, 352–353, 609Single-line comment, 25sizeof() function, 277–279, 333Slashes, stripping out, 395–396SMALLINT data type, 622Smarty, 487SMTP configuration option, 854sort() function, 298, 298–301, 335SORT_LOCALE_STRING flag, 299SORT_NUMERIC flag, 299SORT_REGULAR flag, 299SORT_STRING flag, 299Sorting arrays, 298–306soundex() function, 174–176, 216Space, 24Special characters:
HTML, 210–214strings and, 200–210
Special data types, 68–70Splicing arrays, 318–321split() function, 179, 275, 331, 499, 510spliti() function, 179, 331, 499, 510sprintf() function, 20, 42, 159–160, 216SQL (Structured Query Language), 568–569
See also Data Definition Language (DDL); Data Manipulation Language (DML):
commands/queries, 597–600case sensitivity, 599–600
English-like grammar, 597–598naming conventions, 599reserved words, 599result-set, 600semicolons, use of, 598
Data Definition Language (DDL), 620–633Data Manipulation Language (DML), 603–
620data types, 621–622and the database:
show databases command, 600–601USE command, 601
database tables, 601–603DESCRIBE command, 602–603, 664SHOW FIELDS IN command, 602–603
defined, 595executing SQL statements, 596–597functions, 633–642
date and time, 638–642numeric, 634–636string, 637–638
operators, 608standardization of, 596tutorial, 595–646
SQL errors, fixing, 845–847sqrt() function, 118srand() function, 118sscanf() function, 216Stale cookie, 676Statements, 23–24Static members, 773–774Static variables, 365–367Static Web sites, 1–2Sticky forms, 427–431str_pad() function, 184–185, 216str_repeat() function, 181, 216str_replace() function, 186, 216str_rotl3() function, 216str_shuffle() function, 216str_split() function, 179, 216str_word_count() function, 164, 216strcasecmp() function, 216strchr() function, 191–193, 216strcmp() function, 168–169strcmp() function, 216
index.fm Page 874 Wednesday, October 25, 2006 1:28 PM
Index 875
strcoll() function, 216strcspn() function, 216strfmon() function, 162strftime() function, 822–824stri_ireplace() function, 187, 216stri_replace() function, 185–189strichr() function, 191–193String constant, 62String functions, 155–164
addcslashes() function, 206–208addslashes() function, 206–208ASCII character values:
and the chr() function, 205and the ord() function, 206
changing the case of strings, 164–167chop function, 182comparing strings, 167–174curly brace syntax, 200explode() function, 179finding a position in a string, 189–191finding similarities, 174–178finding the length of a string, 163formatting and printing strings, 155–160formatting numbers and money, 160–162fprintf() function, 160HTML special characters, 210–214htmlentities(), 210, 213–214htmlspecialchars() function, 210–214htmlspecialchars_decode(), 210–214implode() function, 179levenshtein() function, 176–178ltrim() function, 182mb_convert_case() function, 165–167metaphone() function, 174–176money_format() function, 162nl2br() function, 200–202number_format() function, 161–162preg_split() function, 179printf() function, 156–159
format specifier modifiers, 159format specifiers, 158
quote constants, 211repeating a string, 181rtrim() function, 182search and replace, 185–189
similar_text() function, 176–178soundex() function, 174–176special characters, 200–210split() function, 179spliti() function, 179splitting up a string, 179–181sprintf() function, 159–160SQL, 637–638str_pad() function, 184–185str_repeat() function, 181str_replace() function, 185–189str_split() function, 179str_word_count() function, 164strcasecmp() function, 168, 170–172strcmp() function, 168–169, 216strcspn() function, 169strcspn() function, 174stri_ireplace() function, 187stripslashes() function, 208, 217strlen() function, 163strnatcasecmp(str1, str2) function,
171–172strnatcmp(str1, str2) function, 169strncasecomp() function, 169, 170strpos() function, 189–190strripos() function, 191strrpos() function, 191strspn() function, 169, 173strstr() function, 206strtok() function, 179–181strtolower() function, 165–166strtoupper() function, 165–166substrings, 191–199trim() function, 182trimming and padding strings, 181–185ucfirst() function, 165–166ucwords() function, 165–166wordwrap() function, 200–205, 218
String literals and quoting, 62–67(string) operator, 119String operators, 152–155
concatenation, 152–153equality (==) operator, 154functions, 155–164identical (===) operator, 154
index.fm Page 875 Wednesday, October 25, 2006 1:28 PM
876 Index
Strings, 19, 44, 149–220, See also String functions; Substrings
comparing, 125–126defined, 149equality test with, 123identity test with, 123quotes, 150–152
quoting errors, 151–152single quotes, 150string operators, 152–155
special characters and, 200–210strip_tags() function, 216, 453stripcslashes() function, 208, 217stripos() function, 217stripslashes() function, 208, 217, 395stristr() function, 217strlen() function, 163, 217strnatcasecap() function, 217strnatcmp() function, 217strncasecmp() function, 217strncmp() function, 217“Strongly typed” languages, 71strpbrk() function, 217strpos() function, 189–190, 217strrchr() function, 191–193strripos() function, 191strrpos() function, 191, 217strspm() function, 217strstr() function, 217strtok() function, 179–181strtolower() function, 165–166, 217strtotok() function, 217strtoupper() function, 165–166, 217strtr() function, 217Structured Query Language (SQL), See SQLstyle.css, 784Subclasses, 763Subject, 500submit input type, 389Subpatterns, 502substr() function, 191, 193–194, 218substr_compare() function, 217substr_count() function, 191, 198–199,
217
substr_replace() function, 191, 196–198, 217
Substrings:defined, 191functions, 191–199strchr() function, 191–193strichr() function, 191–193strrchr() function, 191–193substr() function, 191, 193–194substr_count() function, 191, 198–199substr_replace() function, 191, 196–
198SUBSTRING(string, position) function,
637Subtraction (–), 112SUM() function, 634Super class, 763Superglobal arrays, 43
PHP, 392where to get information about, 431–432
phpinfo() function, 431–432Superglobal variables, 84Superglobals, 43, 431Superuser, 582Suraski, Zeev, 4switch statement, 48, 228–231Sybase, 14, 595Syntax, 842Syntax errors, 143System/R, 595
TTab, 24Table, 567
altering, 631–632dropping, 633
Tags, 42Ternary operator, 49, 107, 138TEXT data type, 622Text files, searching for patterns in, 554–556text input type, 388textarea input type, 388TextPad, 15Thawte, 834
index.fm Page 876 Wednesday, October 25, 2006 1:28 PM
Index 877
thinkgeek.com, 598$this pseudo-variable, 743TIME data type, 622time() function, 688–689TIME_FORMAT() function, 639–641TIMESTAMP data type, 622TINYINT data type, 622TINYTEXT data type, 622Tokens, 179touch() function, 481Tracking visitors, with cookies, 683–687
tracking a visitor’s last visit, 685–687visitor count example, 683–685
TRANSLATE function, 637trim() function, 167fn, 182, 218TRIM(' string '); function, 637TRUE, 103Type operators, 145
Uuasort() function, 298, 335ucfirst() function, 165–166, 218ucwords() function, 165–166, 218uksort() function, 298, 335Unary operator, 107, 135
defined, 107Union operator, arrays, 327–328UNIX timestamp, 688, 819
creating from a string, 828–829unlink() function, 481–483unserialize() function, 681unset() function, 45, 89–90, 311, 332UPDATE command, 618–619upload_max_filesize, 421upload_tmp_dir directive, 422Uploading files, 421–427
$_FILES array, 422–424<form> tag attributes, 421–422moving the uploaded file, 425–426
UPPER(string) function, 637URL, opening for reading, 463–464user() function, 592User-defined functions, 337–377
callback functions, 358–362
declaring, 338function libraries, 373–376nesting functions, 368–370return values, 351–358scope, 362–367where to put, 338
User-defined setters and getters, 760–761usort() function, 298, 335UTF-8, 213
Vvar keyword, 742var_dump() function, 265–266, 330VARCHAR(SIZE) data type, 622Variable variables, 351Variables, 43, 70–99
and concatenation, 79–80declaring/initializing, 71–72defined, 70displaying, 75–78double, single, and backquotes in
assignment statements, 72–73empty() function, 88–89environment, 84form, 90–99global, 84isset() function, 85–87local, 84managing, 85–90and mixed data types, 78–79print and echo constructs, 75–76references, 80–81scope of, 84shortcut tags, 76–78superglobal, 84types of, 70unset() function, 89–90valid names, 71variable variables, 82–83
VeriSign, 834version() function, 592Vertical tab, 24vfprintf function, 218vi, 15
index.fm Page 877 Wednesday, October 25, 2006 1:28 PM
878 Index
Visual Basic, 41vprintf function, 218vsprintf function, 218
WWeb page:
analysis of, 14–15life cycle of, 13
Web servers, 446, 849WEEKDAY(date) function, 638WHERE clause, 608–609, 619, 630while loop, 49, 232–233Whitespace, 23–24Widenius, Michael (Monty), 7
WinEdit, 15Wordpad, 15wordwrap() function, 200–205, 218World Wide Web (WWW), invention of,
1–2
X–ZXOR (exclusive OR) operator, 608Yahoo!, 2, 7YEAR data type, 622YEAR(date) function, 638Zend engine, 4–5, 9Zend Technologies, 4
Zero-width assertions, 520
index.fm Page 878 Wednesday, October 25, 2006 1:28 PM