| About the Author |
|
xxix | |
| About the Technical Reviewer |
|
xxxi | |
| Introduction |
|
xxxiii | |
| Chapter 1 Installation and Configuration |
|
1 | (28) |
|
Recipe 1-1. Installing PHP |
|
|
1 | (16) |
|
|
|
1 | (1) |
|
|
|
1 | (1) |
|
|
|
2 | (15) |
|
Recipe 1-2. Configuring PHP |
|
|
17 | (4) |
|
|
|
17 | (1) |
|
|
|
17 | (1) |
|
|
|
18 | (3) |
|
Recipe 1-3. Compiling PHP |
|
|
21 | (5) |
|
|
|
21 | (1) |
|
|
|
21 | (1) |
|
|
|
22 | (4) |
|
Recipe 1-4. Installing MySQL |
|
|
26 | (1) |
|
|
|
26 | (1) |
|
|
|
26 | (1) |
|
|
|
27 | (1) |
|
Recipe 1-5. Virtual Machines |
|
|
27 | (2) |
|
|
|
27 | (1) |
|
|
|
27 | (1) |
|
|
|
28 | (1) |
| Chapter 2 Classes and Objects |
|
29 | (32) |
|
Recipe 2-1. Writing a Simple Class |
|
|
29 | (1) |
|
|
|
29 | (1) |
|
|
|
29 | (1) |
|
|
|
29 | (1) |
|
Recipe 2-2. Writing a Base Class |
|
|
30 | (1) |
|
|
|
30 | (1) |
|
|
|
30 | (1) |
|
|
|
30 | (1) |
|
Recipe 2-3. Writing an Abstract Class |
|
|
31 | (2) |
|
|
|
31 | (1) |
|
|
|
31 | (1) |
|
|
|
31 | (2) |
|
Recipe 2-4. Writing an Interface |
|
|
33 | (2) |
|
|
|
33 | (1) |
|
|
|
33 | (1) |
|
|
|
33 | (2) |
|
Recipe 2-5. Class Members as Regular Functions |
|
|
35 | (1) |
|
|
|
35 | (1) |
|
|
|
35 | (1) |
|
|
|
35 | (1) |
|
Recipe 2-6. Protecting Data and Methods |
|
|
36 | (1) |
|
|
|
36 | (1) |
|
|
|
36 | (1) |
|
|
|
36 | (1) |
|
Recipe 2-7. Mixed Static and Object Context |
|
|
37 | (1) |
|
|
|
37 | (1) |
|
|
|
37 | (1) |
|
|
|
38 | (1) |
|
Recipe 2-8. Referencing Class Members |
|
|
38 | (1) |
|
|
|
38 | (1) |
|
|
|
38 | (1) |
|
|
|
38 | (1) |
|
Recipe 2-9. Instantiation of Classes |
|
|
39 | (2) |
|
|
|
39 | (1) |
|
|
|
39 | (1) |
|
|
|
40 | (1) |
|
Recipe 2-10. Printing Objects |
|
|
41 | (1) |
|
|
|
41 | (1) |
|
|
|
41 | (1) |
|
|
|
41 | (1) |
|
Recipe 2-11. Variable Overloading |
|
|
42 | (2) |
|
|
|
42 | (1) |
|
|
|
42 | (1) |
|
|
|
42 | (2) |
|
Recipe 2-12. Serializing Types and Object |
|
|
44 | (2) |
|
|
|
44 | (1) |
|
|
|
44 | (1) |
|
|
|
45 | (1) |
|
Recipe 2-13. Copying an Object |
|
|
46 | (1) |
|
|
|
46 | (1) |
|
|
|
46 | (1) |
|
|
|
46 | (1) |
|
Recipe 2-14. Using Objects as Functions |
|
|
47 | (1) |
|
|
|
47 | (1) |
|
|
|
47 | (1) |
|
|
|
47 | (1) |
|
Recipe 2-15. Overloading Methods |
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
|
|
48 | (1) |
|
Recipe 2-16. Debugging Objects |
|
|
49 | (2) |
|
|
|
49 | (1) |
|
|
|
49 | (1) |
|
|
|
50 | (1) |
|
Recipe 2-17. Using Objects without a Class |
|
|
51 | (1) |
|
|
|
51 | (1) |
|
|
|
51 | (1) |
|
|
|
51 | (1) |
|
Recipe 2-18. Directory Iteration |
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
52 | (1) |
|
Recipe 2-19. Writing Reusable Code |
|
|
53 | (4) |
|
|
|
53 | (1) |
|
|
|
53 | (1) |
|
|
|
53 | (4) |
|
Recipe 2-20. Avoiding Name Collisions |
|
|
57 | (2) |
|
|
|
57 | (1) |
|
|
|
57 | (1) |
|
|
|
57 | (2) |
|
Recipe 2-21. Autoloading Classes on First Use |
|
|
59 | (2) |
|
|
|
59 | (1) |
|
|
|
59 | (1) |
|
|
|
59 | (2) |
| Chapter 3 Performing Math Operations |
|
61 | (16) |
|
Recipe 3-1. Changing the Base Values for Numbers |
|
|
62 | (1) |
|
|
|
62 | (1) |
|
|
|
62 | (1) |
|
|
|
62 | (1) |
|
Recipe 3-2. Converting to a Different Base Value |
|
|
63 | (1) |
|
|
|
63 | (1) |
|
|
|
63 | (1) |
|
|
|
63 | (1) |
|
Recipe 3-3. Storing Binary Values in Integers |
|
|
64 | (1) |
|
|
|
64 | (1) |
|
|
|
64 | (1) |
|
|
|
64 | (1) |
|
Recipe 3-4. Setting and Clearing Bits in Binary |
|
|
65 | (1) |
|
|
|
65 | (1) |
|
|
|
65 | (1) |
|
|
|
65 | (1) |
|
Recipe 3-5. Using Hexadecimal Numbers |
|
|
66 | (1) |
|
|
|
66 | (1) |
|
|
|
66 | (1) |
|
|
|
66 | (1) |
|
Recipe 3-6. Increasing Performance with Binary Shift |
|
|
67 | (2) |
|
|
|
67 | (1) |
|
|
|
67 | (1) |
|
|
|
67 | (2) |
|
Recipe 3-7. Rounding Floating Point Numbers |
|
|
69 | (1) |
|
|
|
69 | (1) |
|
|
|
69 | (1) |
|
|
|
69 | (1) |
|
Recipe 3-8. Generating Random Numbers |
|
|
70 | (1) |
|
|
|
70 | (1) |
|
|
|
70 | (1) |
|
|
|
70 | (1) |
|
Recipe 3-9. Expressing Ratios with Logarithmic Functions |
|
|
71 | (1) |
|
|
|
71 | (1) |
|
|
|
71 | (1) |
|
|
|
71 | (1) |
|
Recipe 3-10. Calculating Future Values |
|
|
71 | (2) |
|
|
|
71 | (1) |
|
|
|
71 | (1) |
|
|
|
72 | (1) |
|
Recipe 3-11. Using Trigonometry to Calculate Distance and Direction |
|
|
73 | (1) |
|
|
|
73 | (1) |
|
|
|
73 | (1) |
|
|
|
73 | (1) |
|
Recipe 3-12. Working with Complex Numbers |
|
|
74 | (3) |
|
|
|
74 | (1) |
|
|
|
74 | (1) |
|
|
|
75 | (2) |
| Chapter 4 Working with Arrays |
|
77 | (32) |
|
Recipe 4-1. Creating Arrays |
|
|
77 | (2) |
|
|
|
77 | (1) |
|
|
|
77 | (1) |
|
|
|
78 | (1) |
|
Recipe 4-2. Changing Arrays |
|
|
79 | (2) |
|
|
|
79 | (1) |
|
|
|
79 | (1) |
|
|
|
80 | (1) |
|
Recipe 4-3. Adding Arrays |
|
|
81 | (5) |
|
|
|
81 | (1) |
|
|
|
82 | (1) |
|
|
|
82 | (4) |
|
Recipe 4-4. Arrays of Arrays |
|
|
86 | (2) |
|
|
|
86 | (1) |
|
|
|
86 | (1) |
|
|
|
86 | (2) |
|
Recipe 4-5. Traversing Arrays |
|
|
88 | (2) |
|
|
|
88 | (1) |
|
|
|
88 | (1) |
|
|
|
88 | (2) |
|
Recipe 4-6. Sorting Arrays |
|
|
90 | (10) |
|
|
|
90 | (1) |
|
|
|
90 | (1) |
|
|
|
90 | (10) |
|
Recipe 4-7. Using Arrays as Stacks |
|
|
100 | (2) |
|
|
|
100 | (1) |
|
|
|
101 | (1) |
|
|
|
101 | (1) |
|
Recipe 4-8. Slicing and Splicing Arrays |
|
|
102 | (3) |
|
|
|
102 | (1) |
|
|
|
102 | (1) |
|
|
|
102 | (3) |
|
Recipe 4-9. Debugging Arrays |
|
|
105 | (2) |
|
|
|
105 | (1) |
|
|
|
105 | (1) |
|
|
|
106 | (1) |
|
Recipe 4-10. Storing Arrays |
|
|
107 | (2) |
|
|
|
107 | (1) |
|
|
|
107 | (1) |
|
|
|
107 | (2) |
| Chapter 5 Dates and limes |
|
109 | (16) |
|
Recipe 5-1. Working with Time Zones |
|
|
109 | (1) |
|
|
|
109 | (1) |
|
|
|
109 | (1) |
|
|
|
110 | (1) |
|
Recipe 5-2. Creating a Timestamp |
|
|
110 | (2) |
|
|
|
110 | (1) |
|
|
|
110 | (1) |
|
|
|
111 | (1) |
|
Recipe 5-3. Working with Dates |
|
|
112 | (1) |
|
|
|
112 | (1) |
|
|
|
112 | (1) |
|
|
|
112 | (1) |
|
Recipe 5-4. Displaying Timestamps |
|
|
113 | (3) |
|
|
|
113 | (1) |
|
|
|
113 | (1) |
|
|
|
113 | (3) |
|
Recipe 5-5. Using ISO Formats |
|
|
116 | (1) |
|
|
|
116 | (1) |
|
|
|
116 | (1) |
|
|
|
116 | (1) |
|
Recipe 5-6. Working with Week Numbers |
|
|
117 | (1) |
|
|
|
117 | (1) |
|
|
|
117 | (1) |
|
|
|
118 | (1) |
|
Recipe 5-7. The DateTime Class |
|
|
118 | (4) |
|
|
|
118 | (1) |
|
|
|
118 | (1) |
|
|
|
118 | (4) |
|
Recipe 5-8. Storing Date and Time Values |
|
|
122 | (1) |
|
|
|
122 | (1) |
|
|
|
122 | (1) |
|
|
|
122 | (1) |
|
Recipe 5-9. Calculating Elapsed Time |
|
|
123 | (2) |
|
|
|
123 | (1) |
|
|
|
123 | (1) |
|
|
|
123 | (2) |
| Chapter 6 Strings |
|
125 | (18) |
|
Recipe 6-1. Creating Strings |
|
|
125 | (1) |
|
|
|
125 | (1) |
|
|
|
125 | (1) |
|
|
|
125 | (1) |
|
Recipe 6-2. Working with the Characters in a String |
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
|
|
126 | (1) |
|
Recipe 6-3. Replacing Characters |
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
|
|
127 | (1) |
|
Recipe 6-4. Creating Long Strings with Heredoc and Newdoc |
|
|
128 | (2) |
|
|
|
128 | (1) |
|
|
|
128 | (1) |
|
|
|
128 | (2) |
|
Recipe 6-5. Escaping Strings |
|
|
130 | (2) |
|
|
|
130 | (1) |
|
|
|
131 | (1) |
|
|
|
131 | (1) |
|
Recipe 6-6. Reformatting Strings |
|
|
132 | (1) |
|
|
|
132 | (1) |
|
|
|
132 | (1) |
|
|
|
132 | (1) |
|
Recipe 6-7. Trimming Whitespace |
|
|
133 | (1) |
|
|
|
133 | (1) |
|
|
|
133 | (1) |
|
|
|
133 | (1) |
|
Recipe 6-8. Finding Strings in Strings |
|
|
133 | (2) |
|
|
|
133 | (1) |
|
|
|
134 | (1) |
|
|
|
134 | (1) |
|
Recipe 6-9. Dividing Strings into Substrings |
|
|
135 | (2) |
|
|
|
135 | (1) |
|
|
|
135 | (1) |
|
|
|
135 | (2) |
|
Recipe 6-10. Displaying HTML Entities |
|
|
137 | (2) |
|
|
|
137 | (1) |
|
|
|
137 | (1) |
|
|
|
137 | (2) |
|
Recipe 6-11. Generating Hash Values for Files |
|
|
139 | (2) |
|
|
|
139 | (1) |
|
|
|
139 | (1) |
|
|
|
139 | (2) |
|
Recipe 6-12. Storing Passwords |
|
|
141 | (2) |
|
|
|
141 | (1) |
|
|
|
141 | (1) |
|
|
|
141 | (2) |
| Chapter 7 Files and Directories |
|
143 | (26) |
|
Recipe 7-1. Include and Require |
|
|
143 | (2) |
|
|
|
143 | (1) |
|
|
|
143 | (1) |
|
|
|
144 | (1) |
|
Recipe 7-2. Reading Files |
|
|
145 | (2) |
|
|
|
145 | (1) |
|
|
|
145 | (1) |
|
|
|
146 | (1) |
|
Recipe 7-3. Writing Files |
|
|
147 | (1) |
|
|
|
147 | (1) |
|
|
|
147 | (1) |
|
|
|
148 | (1) |
|
Recipe 7-4. Copy, Rename, and Remove Files |
|
|
148 | (2) |
|
|
|
148 | (1) |
|
|
|
149 | (1) |
|
|
|
149 | (1) |
|
Recipe 7-5. File Properties |
|
|
150 | (2) |
|
|
|
150 | (1) |
|
|
|
150 | (1) |
|
|
|
150 | (2) |
|
|
|
152 | (1) |
|
|
|
152 | (1) |
|
|
|
152 | (1) |
|
|
|
152 | (1) |
|
Recipe 7-7. Symbolic Links |
|
|
153 | (2) |
|
|
|
153 | (1) |
|
|
|
153 | (1) |
|
|
|
153 | (2) |
|
|
|
155 | (1) |
|
|
|
155 | (1) |
|
|
|
155 | (1) |
|
|
|
155 | (1) |
|
|
|
156 | (3) |
|
|
|
156 | (1) |
|
|
|
156 | (1) |
|
|
|
156 | (3) |
|
|
|
159 | (1) |
|
|
|
159 | (1) |
|
|
|
159 | (1) |
|
|
|
159 | (1) |
|
Recipe 7-11. Stream Context |
|
|
160 | (2) |
|
|
|
160 | (1) |
|
|
|
160 | (1) |
|
|
|
160 | (2) |
|
Recipe 7-12. File Iterators |
|
|
162 | (2) |
|
|
|
162 | (1) |
|
|
|
162 | (1) |
|
|
|
162 | (2) |
|
Recipe 7-13. Download Files |
|
|
164 | (1) |
|
|
|
164 | (1) |
|
|
|
164 | (1) |
|
|
|
164 | (1) |
|
Recipe 7-14. Upload Files |
|
|
165 | (1) |
|
|
|
165 | (1) |
|
|
|
165 | (1) |
|
|
|
165 | (1) |
|
Recipe 7-15. Zipped Files |
|
|
166 | (3) |
|
|
|
166 | (1) |
|
|
|
166 | (1) |
|
|
|
167 | (2) |
| Chapter 8 Dynamic Imaging |
|
169 | (28) |
|
Recipe 8-1. Creating Images |
|
|
169 | (2) |
|
|
|
169 | (1) |
|
|
|
169 | (1) |
|
|
|
170 | (1) |
|
|
|
171 | (2) |
|
|
|
171 | (1) |
|
|
|
171 | (1) |
|
|
|
171 | (2) |
|
|
|
173 | (3) |
|
|
|
173 | (1) |
|
|
|
173 | (1) |
|
|
|
173 | (3) |
|
|
|
176 | (1) |
|
|
|
176 | (1) |
|
|
|
176 | (1) |
|
|
|
176 | (1) |
|
|
|
177 | (1) |
|
|
|
177 | (1) |
|
|
|
177 | (1) |
|
|
|
177 | (1) |
|
Recipe 8-6. Adding a Watermark |
|
|
178 | (2) |
|
|
|
178 | (1) |
|
|
|
178 | (1) |
|
|
|
179 | (1) |
|
Recipe 8-7. Changing Colors |
|
|
180 | (2) |
|
|
|
180 | (1) |
|
|
|
180 | (1) |
|
|
|
180 | (2) |
|
Recipe 8-8. Draw on Images |
|
|
182 | (8) |
|
|
|
182 | (1) |
|
|
|
182 | (1) |
|
|
|
182 | (8) |
|
|
|
190 | (1) |
|
|
|
190 | (1) |
|
|
|
190 | (1) |
|
|
|
190 | (1) |
|
|
|
191 | (2) |
|
|
|
191 | (1) |
|
|
|
191 | (1) |
|
|
|
191 | (2) |
|
Recipe 8-11. Caching Images |
|
|
193 | (4) |
|
|
|
193 | (1) |
|
|
|
193 | (1) |
|
|
|
193 | (4) |
| Chapter 9 Regular Expressions |
|
197 | (12) |
|
Recipe 9-1. Format Validation |
|
|
200 | (3) |
|
|
|
200 | (1) |
|
|
|
200 | (1) |
|
|
|
200 | (3) |
|
|
|
203 | (2) |
|
|
|
203 | (1) |
|
|
|
203 | (1) |
|
|
|
203 | (2) |
|
Recipe 9-3. String Replacement |
|
|
205 | (4) |
|
|
|
205 | (1) |
|
|
|
205 | (1) |
|
|
|
206 | (3) |
| Chapter 10 Variables |
|
209 | (22) |
|
Recipe 10-1. Converting Variable Type |
|
|
209 | (1) |
|
|
|
209 | (1) |
|
|
|
209 | (1) |
|
|
|
210 | (1) |
|
Recipe 10-2. Allocating Memory |
|
|
210 | (2) |
|
|
|
210 | (1) |
|
|
|
210 | (1) |
|
|
|
211 | (1) |
|
Recipe 10-3. Determining Memory Use |
|
|
212 | (1) |
|
|
|
212 | (1) |
|
|
|
212 | (1) |
|
|
|
212 | (1) |
|
Recipe 10-4. Taking Advantage of Variable Scope |
|
|
213 | (1) |
|
|
|
213 | (1) |
|
|
|
213 | (1) |
|
|
|
213 | (1) |
|
Recipe 10-5. Avoiding Global Variable Problems with Super Globals |
|
|
214 | (1) |
|
|
|
214 | (1) |
|
|
|
214 | (1) |
|
|
|
214 | (1) |
|
Recipe 10-6. Determining Variable Type |
|
|
215 | (1) |
|
|
|
215 | (1) |
|
|
|
215 | (1) |
|
|
|
215 | (1) |
|
Recipe 10-7. Reducing Memory Use with References |
|
|
216 | (3) |
|
|
|
216 | (1) |
|
|
|
216 | (1) |
|
|
|
216 | (3) |
|
Recipe 10-8. Using Constants |
|
|
219 | (1) |
|
|
|
219 | (1) |
|
|
|
219 | (1) |
|
|
|
219 | (1) |
|
Recipe 10-9. Variable Variables |
|
|
220 | (1) |
|
|
|
220 | (1) |
|
|
|
220 | (1) |
|
|
|
220 | (1) |
|
Recipe 10-10. Comparing Variables |
|
|
221 | (2) |
|
|
|
221 | (1) |
|
|
|
221 | (1) |
|
|
|
222 | (1) |
|
Recipe 10-11. Working with Strings |
|
|
223 | (1) |
|
|
|
223 | (1) |
|
|
|
223 | (1) |
|
|
|
223 | (1) |
|
Recipe 10-12. Handling Floating Point Numbers |
|
|
224 | (1) |
|
|
|
224 | (1) |
|
|
|
224 | (1) |
|
|
|
224 | (1) |
|
Recipe 10-13. Special Language Constructs |
|
|
225 | (3) |
|
|
|
225 | (1) |
|
|
|
225 | (1) |
|
|
|
225 | (3) |
|
Recipe 10-14. Iterating Over Array Values |
|
|
228 | (1) |
|
|
|
228 | (1) |
|
|
|
228 | (1) |
|
|
|
229 | (1) |
|
Recipe 10-15. Generating Output |
|
|
229 | (2) |
|
|
|
229 | (1) |
|
|
|
229 | (1) |
|
|
|
230 | (1) |
| Chapter 11 Functions |
|
231 | (18) |
|
Recipe 11-1. Calling Functions |
|
|
231 | (1) |
|
|
|
231 | (1) |
|
|
|
231 | (1) |
|
|
|
232 | (1) |
|
Recipe 11-2. Variable Scope |
|
|
232 | (2) |
|
|
|
232 | (1) |
|
|
|
232 | (1) |
|
|
|
233 | (1) |
|
Recipe 11-3. Passing Parameters |
|
|
234 | (2) |
|
|
|
234 | (1) |
|
|
|
234 | (1) |
|
|
|
234 | (2) |
|
Recipe 11-4. Optional Parameters |
|
|
236 | (2) |
|
|
|
236 | (1) |
|
|
|
236 | (1) |
|
|
|
236 | (2) |
|
Recipe 11-5. Type Declarations |
|
|
238 | (1) |
|
|
|
238 | (1) |
|
|
|
238 | (1) |
|
|
|
238 | (1) |
|
Recipe 11-6. Return Values |
|
|
239 | (2) |
|
|
|
239 | (1) |
|
|
|
239 | (1) |
|
|
|
239 | (2) |
|
Recipe 11-7. Check if Function Exists |
|
|
241 | (1) |
|
|
|
241 | (1) |
|
|
|
241 | (1) |
|
|
|
241 | (1) |
|
Recipe 11-8. Calculated Function Names |
|
|
242 | (1) |
|
|
|
242 | (1) |
|
|
|
242 | (1) |
|
|
|
242 | (1) |
|
Recipe 11-9. Anonymous Functions |
|
|
243 | (3) |
|
|
|
243 | (1) |
|
|
|
243 | (1) |
|
|
|
243 | (3) |
|
Recipe 11-10. Variable Parameter List |
|
|
246 | (3) |
|
|
|
246 | (1) |
|
|
|
246 | (1) |
|
|
|
246 | (3) |
| Chapter 12 Web Fundamentals |
|
249 | (22) |
|
|
|
249 | (1) |
|
|
|
249 | (1) |
|
|
|
249 | (1) |
|
|
|
250 | (1) |
|
Recipe 12-2. $_GET and $_POST |
|
|
250 | (3) |
|
|
|
250 | (1) |
|
|
|
251 | (1) |
|
|
|
251 | (2) |
|
|
|
253 | (2) |
|
|
|
253 | (1) |
|
|
|
253 | (1) |
|
|
|
254 | (1) |
|
Recipe 12-4. Server Variables |
|
|
255 | (2) |
|
|
|
255 | (1) |
|
|
|
255 | (1) |
|
|
|
255 | (2) |
|
Recipe 12-5. Session Data |
|
|
257 | (2) |
|
|
|
257 | (1) |
|
|
|
257 | (1) |
|
|
|
258 | (1) |
|
Recipe 12-6. Content Type and Disposition |
|
|
259 | (2) |
|
|
|
259 | (1) |
|
|
|
259 | (1) |
|
|
|
259 | (2) |
|
|
|
261 | (1) |
|
|
|
261 | (1) |
|
|
|
261 | (1) |
|
|
|
261 | (1) |
|
Recipe 12-8. Remote Content |
|
|
262 | (3) |
|
|
|
262 | (1) |
|
|
|
262 | (1) |
|
|
|
263 | (2) |
|
Recipe 12-9. The HTTPS Protocol |
|
|
265 | (1) |
|
|
|
265 | (1) |
|
|
|
265 | (1) |
|
|
|
265 | (1) |
|
Recipe 12-10. AJAX Requests |
|
|
266 | (1) |
|
|
|
266 | (1) |
|
|
|
266 | (1) |
|
|
|
266 | (1) |
|
Recipe 12-11. Web Sockets |
|
|
267 | (4) |
|
|
|
267 | (1) |
|
|
|
267 | (1) |
|
|
|
267 | (4) |
| Chapter 13 Creating and Using Forms |
|
271 | (22) |
|
Recipe 13-1. Form Elements |
|
|
271 | (5) |
|
|
|
271 | (1) |
|
|
|
271 | (3) |
|
|
|
274 | (2) |
|
Recipe 13-2. Default Values |
|
|
276 | (4) |
|
|
|
276 | (1) |
|
|
|
276 | (1) |
|
|
|
277 | (3) |
|
Recipe 13-3. Form Validation |
|
|
280 | (3) |
|
|
|
280 | (1) |
|
|
|
280 | (1) |
|
|
|
280 | (3) |
|
Recipe 13-4. Form Generation |
|
|
283 | (5) |
|
|
|
283 | (1) |
|
|
|
283 | (1) |
|
|
|
284 | (4) |
|
|
|
288 | (2) |
|
|
|
288 | (1) |
|
|
|
288 | (1) |
|
|
|
289 | (1) |
|
|
|
290 | (3) |
|
|
|
290 | (1) |
|
|
|
290 | (1) |
|
|
|
291 | (2) |
| Chapter 14 XML, RSS, WDDX, and SOAP |
|
293 | (24) |
|
Recipe 14-1. Exchanging Data with XML |
|
|
293 | (7) |
|
|
|
293 | (1) |
|
|
|
293 | (1) |
|
|
|
294 | (6) |
|
Recipe 14-2. Generating XML Response |
|
|
300 | (3) |
|
|
|
300 | (1) |
|
|
|
300 | (1) |
|
|
|
300 | (3) |
|
Recipe 14-3. Sharing Data with RSS |
|
|
303 | (3) |
|
|
|
303 | (1) |
|
|
|
304 | (1) |
|
|
|
304 | (2) |
|
Recipe 14-4. Consuming RSS Feeds |
|
|
306 | (2) |
|
|
|
306 | (1) |
|
|
|
307 | (1) |
|
|
|
307 | (1) |
|
Recipe 14-5. Standard Data Exchange |
|
|
308 | (3) |
|
|
|
308 | (1) |
|
|
|
308 | (1) |
|
|
|
309 | (2) |
|
Recipe 14-6. SOAP Server and Client |
|
|
311 | (6) |
|
|
|
311 | (1) |
|
|
|
311 | (1) |
|
|
|
311 | (6) |
| Chapter 15 Data Exchange with JSON |
|
317 | (16) |
|
Recipe 15-1. Fetching Data with AJAX |
|
|
317 | (2) |
|
|
|
317 | (1) |
|
|
|
317 | (1) |
|
|
|
317 | (2) |
|
Recipe 15-2. Returning JSON |
|
|
319 | (2) |
|
|
|
319 | (1) |
|
|
|
319 | (1) |
|
|
|
320 | (1) |
|
Recipe 15-3. Consuming a JSON API |
|
|
321 | (3) |
|
|
|
321 | (1) |
|
|
|
321 | (1) |
|
|
|
321 | (3) |
|
|
|
324 | (3) |
|
|
|
324 | (1) |
|
|
|
324 | (1) |
|
|
|
325 | (2) |
|
Recipe 15-5. Calling API's |
|
|
327 | (3) |
|
|
|
327 | (1) |
|
|
|
327 | (1) |
|
|
|
327 | (3) |
|
Recipe 15-6. API Authentication |
|
|
330 | (3) |
|
|
|
330 | (1) |
|
|
|
330 | (1) |
|
|
|
330 | (3) |
| Chapter 16 Using MySQL Databases |
|
333 | (24) |
|
Recipe 16-1. Connecting to MySQL |
|
|
333 | (4) |
|
|
|
333 | (1) |
|
|
|
333 | (1) |
|
|
|
334 | (3) |
|
Recipe 16-2. Persistent Connections |
|
|
337 | (1) |
|
|
|
337 | (1) |
|
|
|
337 | (1) |
|
|
|
338 | (1) |
|
Recipe 16-3. Fetching Data |
|
|
338 | (3) |
|
|
|
338 | (1) |
|
|
|
339 | (1) |
|
|
|
339 | (2) |
|
Recipe 16-4. Inserting Data |
|
|
341 | (7) |
|
|
|
341 | (1) |
|
|
|
341 | (1) |
|
|
|
341 | (7) |
|
Recipe 16-5. Updating Data |
|
|
348 | (3) |
|
|
|
348 | (1) |
|
|
|
348 | (1) |
|
|
|
349 | (2) |
|
Recipe 16-6. Deleting Data |
|
|
351 | (4) |
|
|
|
351 | (1) |
|
|
|
351 | (1) |
|
|
|
351 | (4) |
|
Recipe 16-7. Schema Information |
|
|
355 | (2) |
|
|
|
355 | (1) |
|
|
|
355 | (1) |
|
|
|
356 | (1) |
| Index |
|
357 | |