Preface |
|
xi | |
1 Orientation and First Steps |
|
1 | (18) |
|
PHP's Place in the Web World |
|
|
1 | (3) |
|
What's So Great About PHP? |
|
|
4 | (2) |
|
PHP Is Free (as in Money) |
|
|
4 | (1) |
|
PHP Is Free (as in Speech) |
|
|
5 | (1) |
|
|
5 | (1) |
|
|
5 | (1) |
|
|
5 | (1) |
|
PHP Is Built for Web Programming |
|
|
6 | (1) |
|
|
6 | (6) |
|
Basic Rules of PHP Programs |
|
|
12 | (5) |
|
|
13 | (1) |
|
Whitespace and Case-Sensitivity |
|
|
14 | (1) |
|
|
15 | (2) |
|
|
17 | (2) |
2 Data: Working with Text and Numbers |
|
19 | (20) |
|
|
19 | (10) |
|
|
20 | (4) |
|
|
24 | (5) |
|
|
29 | (2) |
|
Using Different Kinds of Numbers |
|
|
30 | (1) |
|
|
30 | (1) |
|
|
31 | (5) |
|
|
33 | (1) |
|
Putting Variables Inside Strings |
|
|
34 | (2) |
|
|
36 | (1) |
|
|
37 | (2) |
3 Logic: Making Decisions and Repeating Yourself |
|
39 | (18) |
|
Understanding true and false |
|
|
40 | (1) |
|
|
41 | (2) |
|
Building Complicated Decisions |
|
|
43 | (8) |
|
|
51 | (3) |
|
|
54 | (1) |
|
|
55 | (2) |
4 Groups of Data: Working with Arrays |
|
57 | (24) |
|
|
57 | (5) |
|
|
58 | (2) |
|
Choosing a Good Array Name |
|
|
60 | (1) |
|
|
60 | (1) |
|
Finding the Size of an Array |
|
|
61 | (1) |
|
|
62 | (6) |
|
|
68 | (2) |
|
|
70 | (4) |
|
Using Multidimensional Arrays |
|
|
74 | (3) |
|
|
77 | (1) |
|
|
78 | (3) |
5 Groups of Logic: Functions and Files |
|
81 | (22) |
|
Declaring and Calling Functions |
|
|
82 | (1) |
|
Passing Arguments to Functions |
|
|
83 | (4) |
|
Returning Values from Functions |
|
|
87 | (5) |
|
Understanding Variable Scope |
|
|
92 | (4) |
|
Enforcing Rules on Arguments and Return Values |
|
|
96 | (2) |
|
Running Code in Another File |
|
|
98 | (2) |
|
|
100 | (1) |
|
|
100 | (3) |
6 Data and Logic Together: Working with Objects |
|
103 | (16) |
|
|
104 | (3) |
|
|
107 | (1) |
|
Indicating a Problem with Exceptions |
|
|
108 | (2) |
|
|
110 | (3) |
|
Property and Method Visibility |
|
|
113 | (1) |
|
|
114 | (2) |
|
|
116 | (1) |
|
|
117 | (2) |
7 Exchanging Information with Users: Making Web Forms |
|
119 | (36) |
|
|
123 | (1) |
|
Accessing Form Parameters |
|
|
124 | (3) |
|
Form Processing with Functions |
|
|
127 | (2) |
|
|
129 | (13) |
|
|
131 | (1) |
|
Numeric or String Elements |
|
|
131 | (3) |
|
|
134 | (1) |
|
|
135 | (1) |
|
|
136 | (2) |
|
|
138 | (3) |
|
|
141 | (1) |
|
Displaying Default Values |
|
|
142 | (2) |
|
|
144 | (9) |
|
|
153 | (1) |
|
|
153 | (2) |
8 Remembering Information: Databases |
|
155 | (34) |
|
Organizing Data in a Database |
|
|
156 | (2) |
|
Connecting to a Database Program |
|
|
158 | (2) |
|
|
160 | (2) |
|
Putting Data into the Database |
|
|
162 | (6) |
|
Inserting Form Data Safely |
|
|
168 | (2) |
|
A Complete Data Insertion Form |
|
|
170 | (3) |
|
Retrieving Data from the Database |
|
|
173 | (5) |
|
Changing the Format of Retrieved Rows |
|
|
178 | (1) |
|
Retrieving Form Data Safely |
|
|
179 | (3) |
|
A Complete Data Retrieval Form |
|
|
182 | (4) |
|
|
186 | (1) |
|
|
187 | (2) |
9 Working with Files |
|
189 | (18) |
|
Understanding File Permissions |
|
|
189 | (1) |
|
Reading and Writing Entire Files |
|
|
190 | (2) |
|
|
190 | (2) |
|
|
192 | (1) |
|
Reading and Writing Parts of Files |
|
|
192 | (3) |
|
|
195 | (3) |
|
Inspecting File Permissions |
|
|
198 | (1) |
|
|
199 | (3) |
|
Sanitizing Externally Supplied Filenames |
|
|
202 | (2) |
|
|
204 | (1) |
|
|
204 | (3) |
10 Remembering Users: Cookies and Sessions |
|
207 | (24) |
|
|
208 | (5) |
|
|
213 | (1) |
|
Storing and Retrieving Information |
|
|
214 | (4) |
|
|
218 | (1) |
|
Login and User Identification |
|
|
219 | (7) |
|
Why setcookie() and session_start() Want to Be at the Top of the Page |
|
|
226 | (2) |
|
|
228 | (1) |
|
|
228 | (3) |
11 Talking to Other Websites and Services |
|
231 | (18) |
|
Simple URL Access with File Functions |
|
|
231 | (5) |
|
Comprehensive URL Access with cURL |
|
|
236 | (8) |
|
|
236 | (3) |
|
|
239 | (1) |
|
|
240 | (3) |
|
|
243 | (1) |
|
|
244 | (3) |
|
|
247 | (1) |
|
|
248 | (1) |
12 Debugging |
|
249 | (16) |
|
Controlling Where Errors Appear |
|
|
249 | (2) |
|
|
251 | (3) |
|
|
254 | (7) |
|
|
255 | (3) |
|
|
258 | (3) |
|
Handling Uncaught Exceptions |
|
|
261 | (2) |
|
|
263 | (1) |
|
|
263 | (2) |
13 Testing: Ensuring Your Program Does the Right Thing |
|
265 | (14) |
|
|
266 | (1) |
|
|
266 | (4) |
|
|
270 | (3) |
|
|
273 | (2) |
|
More Information About Testing |
|
|
275 | (1) |
|
|
275 | (1) |
|
|
276 | (3) |
14 Software Engineering Practices You Should Be Aware Of |
|
279 | (6) |
|
|
280 | (1) |
|
|
281 | (1) |
|
Environments and Deployment |
|
|
282 | (1) |
|
|
283 | (1) |
|
|
284 | (1) |
15 Handling Dates and Times |
|
285 | (8) |
|
Displaying the Date or Time |
|
|
285 | (3) |
|
|
288 | (2) |
|
Calculating Dates and Times |
|
|
290 | (1) |
|
|
291 | (1) |
|
|
292 | (1) |
16 Package Management |
|
293 | (6) |
|
|
293 | (1) |
|
Adding a Package to Your Program |
|
|
294 | (1) |
|
|
295 | (1) |
|
Getting More Information on Composer |
|
|
296 | (2) |
|
|
298 | (1) |
17 Sending Email |
|
299 | (4) |
|
|
299 | (2) |
|
|
301 | (2) |
18 Frameworks |
|
303 | (8) |
|
|
304 | (1) |
|
|
305 | (2) |
|
|
307 | (2) |
|
|
309 | (2) |
19 Command-Line PHP |
|
311 | (6) |
|
Writing Command-Line PHP Programs |
|
|
312 | (1) |
|
Using PHP's Built-in Web Server |
|
|
313 | (1) |
|
|
314 | (2) |
|
|
316 | (1) |
20 Internationalization and Localization |
|
317 | (8) |
|
|
318 | (2) |
|
|
320 | (1) |
|
|
321 | (2) |
|
|
323 | (2) |
A Installing and Configuring the PHP Engine |
|
325 | (10) |
B Answers to Exercises |
|
335 | (46) |
Index |
|
381 | |