05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table of Contents<br />

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix<br />

1. Introduction to <strong>PHP</strong> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />

What Does <strong>PHP</strong> Do? 1<br />

A Brief History of <strong>PHP</strong> 2<br />

Installing <strong>PHP</strong> 7<br />

A Walk Through <strong>PHP</strong> 9<br />

2. Language Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />

Lexical Structure 17<br />

Data Types 23<br />

Variables 30<br />

Expressions and Operators 34<br />

Flow-Control Statements 46<br />

Including Code 54<br />

Embedding <strong>PHP</strong> in Web Pages 56<br />

3. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61<br />

Calling a Function 61<br />

Defining a Function 62<br />

Variable Scope 64<br />

Function Parameters 66<br />

Return Values 69<br />

Variable Functions 70<br />

Anonymous Functions 71<br />

4. Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72<br />

Quoting String Constants 72<br />

Printing Strings 75<br />

v

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!