... need yet another book on PHP? And why, now, is it relevant
to point out the good parts? ” Well, this is not just any book, and this is not just any
time in the life of PHP. PHP is gaining adoption ... . xiii
1. The GoodParts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Why PHP? 1
A Brief History of PHP 1
PHP s Place in ... description of what each does.
2 | Chapter 1: The Good Parts
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
PHP: The Good Parts
Peter B. MacIntyre
Beijing
•
Cambridge
•
Farnham
•
Köln
•
Sebastopol
•
Taipei
•
Tokyo
Please...
... your first PHP web page.
4 | Chapter 1: The Good Parts
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
Figure 1-1. Result of phpinfo() function
Basic PHP Setup | ... values. The code
for doing this is one line, like so:
< ?php phpinfo() ; ?>
The way to start and stop PHP content is with the < ?php text sequence and the ?> text
sequence, respectively, ... now, save this code
in your web root folder (usually www or htdocs) as phpinfo .php. When you enter http:
//localhost/phpinfo .php in the browser, the output should resemble Figure 1-1.
Take some...
... PHP looks for files that are named for inclusion or requirement in a
certain order. First, PHP looks for them in the location identified in the
include_path settings within your php. ini ... page2 .php is called. The code for this file
follows:
< ?php
$name = $_POST['fullname'] ;
echo "the full name: " . $name ;
?>
<br/>
<a href="demo .php& quot;>back</a>
$_REQUEST
The ... in the file called my_functions .php) and the code that will be using that function
(saved in another file, called display_msg .php) .
###############
# my_functions .php file
###############
function...
... watermark.
for example, and PHP will not be confused, mainly because PHP requires that
object names be unique.
Encapsulation
Encapsulation is another feature of OOP that PHP makes use of. Encapsulation
allows ... this chapter we will look at object-oriented programming (OOP) and focus on the
best parts of it as embodied in PHP. OOP has been around for many years and is
certainly a very mature programming ... instantiating a class into an object in PHP, the
new
keyword is required.
Methods
A method is merely a function written within the confines of a class. In PHP, we
use the word function to refer...
... than PHP. Because SQLite is built
into the standard deployment of PHP, all you have to do to start using it is to make
reference to it.
If you are using PHP 5.3, you may have to update your php. ini ... to direct PHP to use the desired interface. You can do
this in the php. ini file, as shown here in a Windows environment enabling the MySQL
extension:
extension =php_ pdo.dll
extension =php_ pdo_mysql.dll
If ... dis-
able the MySQL extension and insert the one for Informix:
extension =php_ pdo.dll
//extension =php_ pdo_mysql.dll
extension =php_ pdo_informix.dll
74 | Chapter 7: Database Interaction
Please purchase...
... linking method call now looks like this:
$php_ url = "http://www .php. net" ;
$this->Image('phplogo.jpg',10,10.5,15,8.5,"", $php_ url);
The image is now a clickable link ... it:
require(" / /fpdf/fpdf .php& quot;);
$pdf = new FPDF( );
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(0,10,&apos ;PHP - The Good Parts! ');
$pdf->Output();
As ... following:
$pdf->Cell(0,10,&apos ;PHP - The Good Parts! ' ,1 ,0 ,'R');
This would produce the browser output shown in Figure 8-2.
Figure 8-2. PHP PDF output right aligned, with...
... in a dynamic PDF
104 | Chapter 8: PHP and Friends
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
CHAPTER 10
PHP 5.3 GoodParts
PHP 5.3 was released in June 2009. ... Essential PHP Security (O’Reilly) and Ilia Alshanetsky’s php| architect’s
Guide to PHP Security (Marco Tabini & Associates, Inc.) for more comprehensive
coverage.
118 | Chapter 9: PHP Security
Please ... to
that variable and pass it values, almost like calling an actual function.
122 | Chapter 10: PHP 5.3 Good Parts
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
array(3)...
... our PHP IDE. Your PHP IDE support for PHP 5.3 features
is provided at every level through out PhpED, starting from dynamic syntax highlighting
to parsers, code completion, and PHP debugger. PhpED ... 10: PHP 5.3 Good Parts
Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark.
You can find a listing of available timezones at http://www .php. net/man
ual/en/timezones .php.
There ... countless PHP websites out
there, to be sure, but I hope to save you some Google time by including the references
within these pages.
php. net
http://www .php. net is the home of the PHP language...
... 140
PHP setup, 3
php_ strip_whitespace function, 7
PHP web conferences, 143
PHP websites, 140
phparch.com website, 143
PhpED IDE (NuSphere), 140
phpinfo .php file, 4
Index | 153
Please purchase ... FPDF library)
PDO (see PHP Data Objects)
phone numbers, finding (example), 134
PHP 5.3
goto statement, 145
PHP, defined, 2
PHP, history of, 1
PHP, where used (example), 2
PHP 5.3, 119–131
closures ... news in the PHP world.
Figure 11-4 shows what the phparch.com home page looks like at the time of this
writing.
Figure 11-4. phparch.com home page
PHP/ Web Conferences
A number of great PHP and web...
...
.424
7.50 x 9.25
7.50 x 9.25
php| architect’s
Guide to
PHP Security
A Step-by-step Guide to Writing
Secure and Reliable PHP Applications
Ilia Alshanetsky
php| architect’s
Guide to
PHP Security
NanoBooks ... excellent, in-depth resources created by the publishers of
php| architect (http://www.phparch.com), the world’s premier magazine dedicated
to PHP professionals.
NanoBooks focus on delivering high-quality ... fluff
of larger, more expensive books.
Shelve under PHP/ Web Development/Internet Programming
From the publishers of
php| architect’s Guide to PHP Security
Ilia Alshanetsky
US $32.99
Canada $47.99
UK...