Skip to Content
PHP: The Good Parts
book

PHP: The Good Parts

by Peter MacIntyre
April 2010
Beginner
174 pages
4h 24m
English
O'Reilly Media, Inc.
Content preview from PHP: The Good Parts

Chapter 2. Casing the Joint

Now that you know the very basics of a PHP file, how to run it through a web server, and how to display some content in a web browser, let’s look more closely at the language’s building blocks and how you can use them to construct larger, more complex websites and web applications. I call this process casing the joint because it involves taking a basic cursory look at the PHP environment to get a better handle on the basics of a PHP code file. The mastery of the building blocks you will be exposed to in this chapter will stand you in good stead, so be sure that you have a strong understanding of them and that you know how and when to use them. Initially, we will look at small segments of a PHP code file (like variables and types of data), and then we will discuss how to control the outcome of a request with the use of decision-making code, also known as flow control. Finally, we will explore some concepts that explain the overall environment of a PHP application: where items are placed in memory (server versus client) and how to retrieve information from those areas.

Whitespace, Comments, and Basic Syntax

As far as PHP is concerned, whitespace is ignored when code is sent to the interpreter. This means that all comments and blank lines are effectively stripped out of the code file as it is running.

Note

If you’re trying to achieve microoptimization and want to send some really clean code to the interpreter so that it doesn’t have to take time to strip out ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

PHP Cookbook

PHP Cookbook

David Sklar, Adam Trachtenberg
PHP Cookbook

PHP Cookbook

Eric A. Mann
Better PHP Development

Better PHP Development

Younes Rafie, Reza Lavaryan, Christopher Pitt, Bruno Skvorc, Thomas Punt
Learning PHP

Learning PHP

David Sklar

Publisher Resources

ISBN: 9781449387761Errata Page