Complete Modern PHP New Features and Good Practices 1st Edition Josh Lockhart PDF For All Chapters

Download as pdf or txt
Download as pdf or txt
You are on page 1of 62

Download the full version of the textbook now at textbookfull.

com

Modern PHP new features and good practices


1st Edition Josh Lockhart

https://textbookfull.com/product/modern-php-new-
features-and-good-practices-1st-edition-josh-
lockhart/

Explore and download more textbook at https://textbookfull.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Web content management systems features and best practices


First Edition Barker

https://textbookfull.com/product/web-content-management-systems-
features-and-best-practices-first-edition-barker/

textbookfull.com

Arithmetic Lockhart

https://textbookfull.com/product/arithmetic-lockhart/

textbookfull.com

PHP Web Services APIs for the Modern Web 2nd Edition Lorna
Jane Mitchell

https://textbookfull.com/product/php-web-services-apis-for-the-modern-
web-2nd-edition-lorna-jane-mitchell/

textbookfull.com

Laparoscopic Colon Surgery: Milestones, Education, & Best


Practice Gregory Kouraklis

https://textbookfull.com/product/laparoscopic-colon-surgery-
milestones-education-best-practice-gregory-kouraklis/

textbookfull.com
Lessons from Frankenstorm Investing for Future Power
Disruptions 1st Edition John Licata

https://textbookfull.com/product/lessons-from-frankenstorm-investing-
for-future-power-disruptions-1st-edition-john-licata/

textbookfull.com

Rooftop Urban Agriculture 1st Edition Francesco Orsini

https://textbookfull.com/product/rooftop-urban-agriculture-1st-
edition-francesco-orsini/

textbookfull.com

Industrial Hygiene Control of Airborne Chemical Hazards,


Second Edition William Popendorf (Author)

https://textbookfull.com/product/industrial-hygiene-control-of-
airborne-chemical-hazards-second-edition-william-popendorf-author/

textbookfull.com

Robert Louis Stevenson’s Pacific Impressions: Photography


and Travel Writing, 1888–1894 Carla Manfredi

https://textbookfull.com/product/robert-louis-stevensons-pacific-
impressions-photography-and-travel-writing-1888-1894-carla-manfredi/

textbookfull.com

HCI International 2019 Posters 21st International


Conference HCII 2019 Orlando FL USA July 26 31 2019
Proceedings Part III Constantine Stephanidis
https://textbookfull.com/product/hci-international-2019-posters-21st-
international-conference-hcii-2019-orlando-fl-usa-
july-26-31-2019-proceedings-part-iii-constantine-stephanidis/
textbookfull.com
The Practice Manager Third Edition Drury

https://textbookfull.com/product/the-practice-manager-third-edition-
drury/

textbookfull.com
Modern PHP
“For

Modern PHP
PHP is experiencing a renaissance, though it may be difficult to tell with all of years I've struggled
the outdated PHP tutorials online. With this practical guide, you’ll learn how
to recommend a PHP
PHP has become a full-featured, mature language with object-orientation,
namespaces, and a growing collection of reusable component libraries. book that reflected
Author Josh Lockhart—creator of PHP The Right Way, a popular initiative
the current state of
to encourage PHP best practices—reveals these new language features the language and
in action. You’ll learn best practices for application architecture and community. With Modern
planning, databases, security, testing, debugging, and deployment. If
PHP, I finally have a title
you have a basic understanding of PHP and want to bolster your skills,
this is your book. I can endorse without

■■ Learn modern PHP features, such as namespaces, traits,


hesitation. ” —Ed Finkler
generators, and closures Developer and author, Funkatron.com

■■ Discover how to find, use, and create PHP components


■■ Follow best practices for application security, working “Inonlyprogramming, the
constant is change.
withdatabases, errors and exceptions, and more
■■ Learn tools and techniques for deploying, tuning, testing, and
PHP is changing, and
profiling your PHP applications the way you develop

Modern
■■ Explore Facebook’s HVVM and Hack language applications has to
implementations—and how they affect modern PHP as well. Josh has laid
■■ Build a local development environment that closely matches out the tools and
your production server concepts that you

PHP
need to be aware of to
Josh Lockhart created the Slim Framework, a popular PHP micro framework write modern PHP.
that enables rapid web application and API development. He also started and
currently curates PHP The Right Way, a popular initiative in the PHP commu- —Cal Evans
nity that encourages good practices and disseminates quality information to PHP
developers worldwide. He is a developer at New Media Campaigns in Carrboro,
North Carolina.

Lockhart

PHP
Twitter: @oreillymedia NEW FEATURES AND GOOD PRACTICES
facebook.com/oreilly
US $29.99 CAN $34.99
ISBN: 978-1-491-90501-2

Josh Lockhart
Modern PHP
“For

Modern PHP
PHP is experiencing a renaissance, though it may be difficult to tell with all of years I've struggled
the outdated PHP tutorials online. With this practical guide, you’ll learn how
to recommend a PHP
PHP has become a full-featured, mature language with object-orientation,
namespaces, and a growing collection of reusable component libraries. book that reflected
Author Josh Lockhart—creator of PHP The Right Way, a popular initiative
the current state of
to encourage PHP best practices—reveals these new language features the language and
in action. You’ll learn best practices for application architecture and community. With Modern
planning, databases, security, testing, debugging, and deployment. If
PHP, I finally have a title
you have a basic understanding of PHP and want to bolster your skills,
this is your book. I can endorse without

■■ Learn modern PHP features, such as namespaces, traits,


hesitation. ” —Ed Finkler
generators, and closures Developer and author, Funkatron.com

■■ Discover how to find, use, and create PHP components


■■ Follow best practices for application security, working with “Inonlyprogramming, the
constant is change.
databases, errors and exceptions, and more
■■ Learn tools and techniques for deploying, tuning, testing, and
PHP is changing, and
profiling your PHP applications the way you develop

Modern
■■ Explore Facebook’s HVVM and Hack language applications has to
implementations—and how they affect modern PHP as well. Josh has laid
■■ Build a local development environment that closely matches out the tools and
your production server concepts that you

PHP
need to be aware of to
Josh Lockhart created the Slim Framework, a popular PHP micro framework write modern PHP.
that enables rapid web application and API development. He also started and
currently curates PHP The Right Way, a popular initiative in the PHP commu- —Cal Evans
nity that encourages good practices and disseminates quality information to PHP
developers worldwide. He is a developer at New Media Campaigns in Carrboro,
North Carolina.

Lockhart

PHP
Twitter: @oreillymedia NEW FEATURES AND GOOD PRACTICES
facebook.com/oreilly
US $29.99 CAN $34.99
ISBN: 978-1-491-90501-2

Josh Lockhart
Modern PHP
New Features and Good Practices

Josh Lockhart
Modern PHP
by Josh Lockhart
Copyright © 2015 Josh Lockhart. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/
institutional sales department: 800-998-9938 or [email protected].

Editor: Allyson MacDonald Indexer: Judy McConville


Production Editor: Nicole Shelby Interior Designer: David Futato
Copyeditor: Phil Dangler Cover Designer: Ellie Volckhausen
Proofreader: Eileen Cohen Illustrator: Rebecca Demarest

February 2015: First Edition

Revision History for the First Edition


2015-02-09: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781491905012 for release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Modern PHP, the cover image, and
related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.

978-1-491-90501-2
[LSI]
For Laurel
Table of Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii

Part I. Language Features

1. The New PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


Past 1
Present 2
Future 3

2. Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Namespaces 5
Why We Use Namespaces 7
Declaration 8
Import and Alias 9
Helpful Tips 11
Code to an Interface 13
Traits 17
Why We Use Traits 18
How to Create a Trait 19
How to Use a Trait 20
Generators 22
Create a Generator 22
Use a Generator 23
Closures 25
Create 25
Attach State 27
Zend OPcache 29

v
Enable Zend OPcache 29
Configure Zend OPcache 31
Use Zend OPcache 31
Built-in HTTP server 31
Start the Server 32
Configure the Server 32
Router Scripts 33
Detect the Built-in Server 33
Drawbacks 33
What’s Next 34

Part II. Good Practices

3. Standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
PHP-FIG to the Rescue 37
Framework Interoperability 38
Interfaces 38
Autoloading 39
Style 39
What Is a PSR? 40
PSR-1: Basic Code Style 40
PSR-2: Strict Code Style 41
PSR-3: Logger Interface 45
Write a PSR-3 Logger 46
Use a PSR-3 Logger 47
PSR-4: Autoloaders 47
Why Autoloaders Are Important 47
The PSR-4 Autoloader Strategy 48
How to Write a PSR-4 Autoloader (and Why You Shouldn’t) 49

4. Components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Why Use Components? 51
What Are Components? 52
Components Versus Frameworks 53
Not All Frameworks Are Bad 54
Use the Right Tool for the Job 54
Find Components 55
Shop 56
Choose 56
Leave Feedback 57
Use PHP Components 57

vi | Table of Contents
How to Install Composer 58
How to Use Composer 59
Example Project 61
Composer and Private Repositories 64
Create PHP Components 66
Vendor and Package Names 66
Namespaces 66
Filesystem Organization 67
The composer.json File 68
The README file 70
Component Implementation 71
Version Control 72
Packagist Submission 73
Using the Component 74

5. Good Practices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Sanitize, Validate, and Escape 75
Sanitize Input 76
Validate Data 79
Escape Output 80
Passwords 80
Never Know User Passwords 81
Never Restrict User Passwords 81
Never Email User Passwords 81
Hash User Passwords with bcrypt 82
Password Hashing API 82
Password Hashing API for PHP < 5.5.0 87
Dates, Times, and Time Zones 87
Set a Default Time Zone 88
The DateTime Class 88
The DateInterval Class 89
The DateTimeZone Class 91
The DatePeriod Class 92
The nesbot/carbon Component 93
Databases 93
The PDO Extension 93
Database Connections and DSNs 93
Prepared Statements 96
Query Results 98
Transactions 100
Multibyte Strings 103
Character Encoding 104

Table of Contents | vii


Output UTF-8 Data 105
Streams 106
Stream Wrappers 106
Stream Context 109
Stream Filters 110
Custom Stream Filters 112
Errors and Exceptions 115
Exceptions 115
Exception Handlers 118
Errors 119
Error Handlers 121
Errors and Exceptions During Development 123
Production 124

Part III. Deployment, Testing, and Tuning

6. Hosting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Shared Server 129
Virtual Private Server 130
Dedicated Server 131
PaaS 131
Choose a Hosting Plan 132

7. Provisioning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Our Goal 134
Server Setup 134
First Login 134
Software Updates 135
Nonroot User 135
SSH Key-Pair Authentication 136
Disable Passwords and Root Login 138
PHP-FPM 138
Install 138
Global Configuration 139
Pool Configuration 140
nginx 143
Install 143
Virtual Host 143
Automate Server Provisioning 146
Delegate Server Provisioning 146
Further Reading 147

viii | Table of Contents


Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
What’s Next 147

8. Tuning. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
The php.ini File 149
Memory 150
Zend OPcache 151
File Uploads 152
Max Execution Time 153
Session Handling 154
Output Buffering 155
Realpath Cache 155
Up Next 155

9. Deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Version Control 157
Automate Deployment 157
Make It Simple 158
Make It Predictable 158
Make It Reversible 158
Capistrano 158
How It Works 158
Install 159
Configure 159
Authenticate 161
Prepare the Remote Server 161
Capistrano Hooks 162
Deploy Your Application 163
Roll Back Your Application 163
Further Reading 163
What’s Next 163

10. Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165


Why Do We Test? 165
When Do We Test? 166
Before 166
During 166
After 166
What Do We Test? 166
How Do We Test? 167
Unit Tests 167
Test-Driven Development (TDD) 167
Behavior-Driven Development (BDD) 167

Table of Contents | ix
PHPUnit 168
Directory Structure 169
Install PHPUnit 170
Install Xdebug 170
Configure PHPUnit 171
The Whovian Class 172
The WhovianTest Test Case 173
Run Tests 175
Code Coverage 176
Continuous Testing with Travis CI 177
Setup 177
Run 178
Further Reading 178
What’s Next 179

11. Profiling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181


When to Use a Profiler 181
Types of Profilers 181
Xdebug 182
Configure 182
Trigger 183
Analyze 183
XHProf 183
Install 184
XHGUI 184
Configure 185
Trigger 185
New Relic Profiler 185
Blackfire Profiler 186
Further Reading 186
What’s Next 186

12. HHVM and Hack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187


HHVM 187
PHP at Facebook 188
HHVM and Zend Engine Parity 189
Is HHVM Right for Me? 190
Install 190
Configure 191
Extensions 192
Monitor HHVM with Supervisord 192
HHVM, FastCGI, and Nginx 194

x | Table of Contents
The Hack Language 195
Convert PHP to Hack 196
What is a Type? 196
Static Typing 197
Dynamic Typing 198
Hack Goes Both Ways 198
Hack Type Checking 199
Hack Modes 200
Hack Syntax 200
Hack Data Structures 202
HHVM/Hack vs. PHP 203
Further Reading 204

13. Community. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205


Local PUG 205
Conferences 205
Mentoring 206
Stay Up-to-Date 206
Websites 206
Mailing Lists 206
Twitter 206
Podcasts 206
Humor 207

A. Installing PHP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

B. Local Development Environments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229

Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237

Table of Contents | xi
Preface

There are a million PHP tutorials online. Most of these tutorials are outdated and
demonstrate obsolete practices. Unfortunately, these tutorials are still referenced
today thanks to their Google immortality. Outdated information is dangerous to
unaware PHP programmers who unknowingly create slow and insecure PHP applica‐
tions. I recognized this issue in 2013, and it is the primary reason I began PHP The
Right Way, a community initiative to provide PHP programmers easy access to high-
quality and up-to-date information from authoritative members of the PHP
community.
Modern PHP is my next endeavor toward the same goal. This book is not a reference
manual. Nope. This book is a friendly and fun conversation between you and me. I’ll
introduce you to the modern PHP programming language. I’ll show you the latest
PHP techniques that I use every day at work and on my open source projects. And I’ll
help you use the latest coding standards so you can share your PHP components and
libraries with the PHP community.
You’ll hear me say “community” over and over (and over). The PHP community is
friendly and helpful and welcoming—although not without occasional drama. If you
become curious about a specific feature mentioned in this book, reach out to your
local PHP user group with questions. I guarantee you there are nearby PHP develop‐
ers who would love to help you become a better PHP programmer. Your local PHP
user group is an invaluable resource as you continue to improve your PHP skills long
after you finish this book.

What You Need to Know About This Book


Before we get started, I want to set a few expectations. First, it is impossible for me to
cover every way to use PHP. There isn’t enough time. Instead, I will show you how I
use PHP. Yes, this is an opinionated approach, but I use the very same practices and
standards adopted by many other PHP developers. What you take away from our
brief conversation will be immediately applicable in your own projects.

xiii
Second, I assume you are familiar with variables, conditionals, loops, and so on; you
don’t have to know PHP, but you should at least bring a basic understanding of these
fundamental programming concepts. You can also bring coffee (I love coffee). I’ll
supply everything else.
Third, I do not assume you are using a specific operating system. However, my code
examples are written for Linux. Bash commands are provided for Ubuntu and
CentOS and may also work on OS X. If you use Windows, I highly recommend you
spin up a Linux virtual machine so you can run the example code in this book.

How This Book Is Organized


Part I demonstrates new PHP features like namespaces, generators, and traits. It
introduces you to the modern PHP language, and it exposes you to features you may
not have known about until now.
Part II explores good practices that you should implement in your PHP applications.
Have you heard the term PSR, but you’re not entirely sure what it is or how to use it?
Do you want to learn how to sanitize user input and use safe database queries? This
chapter is for you.
Part III is more technical than the first two parts. It demonstrates how to deploy,
tune, test, and profile PHP applications. We dive into deployment strategies with
Capistrano. We talk about testing tools like PHPUnit and Travis CI. And we explore
how to tune PHP so it performs as well as possible for your application.
Appendix A provides step-by-step instructions for installing and configuring PHP-
FPM on your machine.
Appendix B explains how to build a local development environment that closely
matches your production server. We explore Vagrant, Puppet, Chef, and alternative
tools to help you get started quickly.

Conventions Used in This Book


The following typographical conventions are used in this book:
Italic
Indicates new terms, URLs, email addresses, filenames, and file extensions.
Constant width
Used for program listings, as well as within paragraphs to refer to program ele‐
ments such as variable or function names, databases, data types, environment
variables, statements, and keywords.

xiv | Preface
Constant width bold
Shows commands or other text that should be typed literally by the user.
Constant width italic
Shows text that should be replaced with user-supplied values or by values deter‐
mined by context.

This element signifies a tip or suggestion.

This element signifies a general note.

This element indicates a warning or caution.

Using Code Examples


Supplemental material (code examples, exercises, etc.) is available for download at
https://github.com/codeguy/modern-php.
This book is here to help you get your job done. In general, if example code is offered
with this book, you may use it in your programs and documentation. You do not
need to contact us for permission unless you’re reproducing a significant portion of
the code. For example, writing a program that uses several chunks of code from this
book does not require permission. Selling or distributing a CD-ROM of examples
from O’Reilly books does require permission. Answering a question by citing this
book and quoting example code does not require permission. Incorporating a signifi‐
cant amount of example code from this book into your product’s documentation does
require permission.
We appreciate, but do not require, attribution. An attribution usually includes the
title, author, publisher, and ISBN. For example: “Modern PHP by Josh Lockhart
(O’Reilly). Copyright 2015 Josh Lockhart, 978-1-491-90501-2.”
If you feel your use of code examples falls outside fair use or the permission given
above, feel free to contact us at [email protected].

Preface | xv
Safari® Books Online
Safari Books Online is an on-demand digital library that deliv‐
ers expert content in both book and video form from the
world’s leading authors in technology and business.

Technology professionals, software developers, web designers, and business and crea‐
tive professionals use Safari Books Online as their primary resource for research,
problem solving, learning, and certification training.
Safari Books Online offers a range of plans and pricing for enterprise, government,
education, and individuals.
Members have access to thousands of books, training videos, and prepublication
manuscripts in one fully searchable database from publishers like O’Reilly Media,
Prentice Hall Professional, Addison-Wesley Professional, Microsoft Press, Sams, Que,
Peachpit Press, Focal Press, Cisco Press, John Wiley & Sons, Syngress, Morgan Kauf‐
mann, IBM Redbooks, Packt, Adobe Press, FT Press, Apress, Manning, New Riders,
McGraw-Hill, Jones & Bartlett, Course Technology, and hundreds more. For more
information about Safari Books Online, please visit us online.

How to Contact Us
Please address comments and questions concerning this book to the publisher:

O’Reilly Media, Inc.


1005 Gravenstein Highway North
Sebastopol, CA 95472
800-998-9938 (in the United States or Canada)
707-829-0515 (international or local)
707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and any additional
information. You can access this page at http://bit.ly/modern_php.
To comment or ask technical questions about this book, send email to bookques‐
[email protected].
For more information about our books, courses, conferences, and news, see our web‐
site at http://www.oreilly.com.
Find us on Facebook: http://facebook.com/oreilly
Follow us on Twitter: http://twitter.com/oreillymedia
Watch us on YouTube: http://www.youtube.com/oreillymedia

xvi | Preface
Acknowledgments
This is my first book. When O’Reilly approached me about writing Modern PHP, I
was equally excited and scared to death. The first thing I did was a Walter Huston
dance; I mean, O’Reilly wanted me to write a book. How cool is that!? Then I asked
myself can I really write that many pages? A book isn’t a quick or small task.
Of course, I immediately said “yes.” I knew I could write Modern PHP because I had
family, friends, coworkers, editors, and reviewers supporting me the entire way. I
want to acknowledge and thank my supporters for their invaluable feedback. Without
them, this book would never have happened.
First, I want to thank my editor at O’Reilly Media—Allyson MacDonald (@allyator‐
eilly). Ally was nice, critical, supportive, and smart. She knew exactly how and when
to gently nudge me in the right direction whenever I got off track. I can’t imagine
working with a better editor.
I also want to thank my technical reviewers—Adam Fairholm (@adamfairholm) and
Ed Finkler (@funkatron). Adam is a brilliant web developer at Newfangled, and he is
perhaps best known for his work on IMVDb—the popular music video database. Ed
is well-known throughout the PHP community for his incredible PHP skills, his per‐
sonality on the /dev/hell podcast, and his commendable Open Sourcing Mental Ill‐
ness campaign. Adam and Ed both pointed out everything dumb, illogical, and
incorrect in my early drafts. This book is far better than anything I could write on my
own thanks to their brutally honest feedback. I am forever indebted to them for their
guidance and wisdom. If any faults or inaccuracies wriggled their way into the final
manuscript, those faults are surely my own.
My coworkers at New Media Campaigns have been a constant source of encourage‐
ment. Joel, Clay, Kris, Alex, Patrick, Ashley, Lenny, Claire, Todd, Pascale, Henry, and
Nathan—I tip my hat to all of you for your kind words of encouragement from begin‐
ning to end.
And most important, I want to thank my family—Laurel, Ethan, Tessa, Charlie, Lisa,
Glenn, and Liz. Thank you for your encouragement, without which I would have
never finished this book. To my lovely wife, Laurel, thank you for your patience.
Thank you for accompanying me to Caribou Coffee for so many late-night writing
sessions. Thank you for letting me abandon you on weekends. Thank you for keeping
me motivated and on schedule. I love you now and forever.

Preface | xvii
Visit https://textbookfull.com
now to explore a rich
collection of eBooks, textbook
and enjoy exciting offers!
PART I
Language Features
CHAPTER 1
The New PHP

The PHP language is experiencing a renaissance. PHP is transforming into a modern


scripting language with helpful features like namespaces, traits, closures, and a built-
in opcode cache. The modern PHP ecosystem is evolving, too. PHP developers rely
less on monolithic frameworks and more on smaller specialized components. The
Composer dependency manager is revolutionizing how we build PHP applications; it
emancipates us from a framework’s walled garden and lets us mix and match intero‐
perable PHP components best suited for our custom PHP applications. Component
interoperability would not be possible without community standards proposed and
curated by the PHP Framework Interop Group.
Modern PHP is your guide to the new PHP, and it will show you how to build and
deploy amazing PHP applications using community standards, good practices, and
interoperable components.

Past
Before we explore modern PHP, it is important to understand PHP’s origin. PHP is
an interpreted server-side scripting language. This means you write PHP code,
upload it to a web server, and execute it with an interpreter. PHP is typically used
with a web server like Apache or nginx to serve dynamic content. However, PHP can
also be used to build powerful command-line applications (just like bash, Ruby,
Python, and so on). Many PHP developers don’t realize this and miss out on a really
exciting feature. Not you, though.
You can read the official PHP history at http://php.net/manual/history.php.php. I won’t
repeat what has already been said so well by Rasmus Lerdorf (the creator of PHP).
What I will tell you is that PHP has a tumultuous past. PHP began as a collection of
CGI scripts written by Rasmus Lerdorf to track visits to his online resume. Lerdorf

1
named his set of CGI scripts “Personal Home Page Tools.” This early incarnation was
completely different from the PHP we know today. Lerdorf ’s early PHP Tools were
not a scripting language; they were tools that provided rudimentary variables and
automatic form variable interpretation using an HTML embedded syntax.
Between 1994 and 1998, PHP underwent numerous revisions and even received a few
ground-up rewrites. Andi Gutmans and Zeev Suraski, two developers from Tel Aviv,
joined forces with Rasmus Lerdorf to transform PHP from a small collection of CGI
tools into a full-fledged programming language with a more consistent syntax and
basic support for object-oriented programming. They named their final product
PHP 3 and released it in late 1998. The new PHP moniker was a departure from ear‐
lier names, and it is a recursive acronym for PHP: Hypertext Preprocessor. PHP 3 was
the first version that most resembled the PHP we know today. It provided superior
extensibility to various databases, protocols, and APIs. PHP 3’s extensibility attracted
many new developers to the project. By late 1998, PHP 3 was already installed on a
staggering 10% of the world’s web servers.

Present
Today, the PHP language is quickly evolving and is supported by dozens of core team
developers from around the world. Development practices have changed, too. In the
past, it was common practice to write a PHP file, upload it to a production server
with FTP, and hope it worked. This is a terrible development strategy, but it was nec‐
essary due to a lack of viable local development environments.
Nowadays, we eschew FTP and use version control instead. Version control software
like Git helps maintain an auditable code history that can be branched, forked, and
merged. Local development environments are identical to production servers thanks
to virtualization tools like Vagrant and provisioning tools like Ansible, Chef, and
Puppet. We leverage specialized PHP components with the Composer dependency
manager. Our PHP code adheres to PSRs—community standards managed by the
PHP Framework Interop Group. We thoroughly test our code with tools like
PHPUnit. We deploy our applications with PHP’s FastCGI process manager behind a
web server like nginx. And we increase application performance with an opcode
cache.
Modern PHP encompasses many new practices that may be unfamiliar to those of
you new to PHP, or to those upgrading from older PHP versions. Don’t feel over‐
whelmed. I’ll walk through each concept later in this book.
I’m also excited that PHP now has an official draft specification—something it lacked
until 2014.

2 | Chapter 1: The New PHP


Most mature programming languages have a specification. In lay‐
man’s terms, a specification is a canonical blueprint that defines
what it means to be PHP. This blueprint is used by developers who
create programs that parse, interpret, and execute PHP code. It is
not for developers who create applications and websites with PHP.

Sara Golemon and Facebook announced the first PHP specification draft at O’Reilly’s
OSCON conference in 2014. You can read the official announcement on the PHP
internals mailing list, and you can read the PHP specification on GitHub.
An official PHP language specification is becoming more important given the intro‐
duction of multiple competing PHP engines. The original PHP engine is the Zend
Engine, a PHP interpreter written in C and introduced in PHP 4. The Zend Engine
was created by Rasmus Lerdorf, Andi Gutmans, and Zeev Suraski. Today the Zend
Engine is the Zend company’s main contribution to the PHP community. However,
there is now a second major PHP engine—the HipHop Virtual Machine from Face‐
book. A language specification ensures that both engines maintain a baseline
compatibility.

A PHP engine is a program that parses, interprets, and executes


PHP code (e.g., the Zend Engine or Facebook’s HipHop Virtual
Machine). This is not to be confused with PHP, which is a generic
reference to the PHP language.

Future
The Zend Engine is improving at a rapid pace with new features and improved per‐
formance. I attribute the Zend Engine’s improvements to its new competition, specifi‐
cally Facebook’s HipHop Virtual Machine and Hack programming language.
Hack is a new programming language built on top of PHP. It introduces static typing,
new data structures, and additional interfaces while maintaining backward compati‐
bility with existing dynamically typed PHP code. Hack is targeted at developers who
appreciate PHP’s rapid development characteristics but need the predictability and
stability from static typing.

We’ll discuss dynamic versus static typing later in this book. The
difference between the two is when PHP types are checked.
Dynamic types are checked at runtime, whereas static types are
checked at compile time. Jump ahead to Chapter 12 for more
information.

Future | 3
Random documents with unrelated
content Scribd suggests to you:
If this man had lived long enough, he might have furnished an
instance of hernia of the stomach or of intestine into the
pericardium. The preparation is in the military museum at Chatham,
Class 1, Div. 1, Sect. 7, No. 156.
a, right ventricle;
b, left ditto;
c, right auricle;
d, left ditto;
e, aorta;
f, pulmonary artery;
g, coronary ditto;
h, a portion of the cartilages of the ribs seen on the inside;
i, a portion of the diaphragm;
k, the pericardium.
1, a portion of the pericardium reflected to show abnormal adhesions to the surface of the
heart;
2, aperture of wound through the diaphragm and the pericardium;
3, pendulous slice off the substance of the right ventricle;
4, puckered cicatrix of the wound of the ventricle.

That the heart, when exposed, is insensible, or nearly so, to the


touch, was known to Galen and to Harvey. Galen is said to have
removed a part of the sternum and pericardium, and to have laid his
finger on the heart. Harvey did the same to the son of Lord
Montgomery, who was wounded in the chest. Professor J. K. Jung
not only introduced needles into the hearts of animals, but also
galvanized them without disadvantage, although Admiral Villeneuve
is supposed to have died suddenly from running a long pin into his
heart, which scarcely left the mark of its entrance.
That persons may die from the shock of a blow on the heart, need
not be doubted, and that they do die when little blood is lost, is
admitted. History preserves the fact that Latour d’Auvergne, Captain
of the 46th demi-brigade, who had obtained the honorable title of
“Premier Grenadier de France,” fell and died immediately after
receiving a wound from a lance at Neustadt, in the month of July of
the sixth year of the Republic; it struck the left ventricle of the heart
near its apex, but did not penetrate its cavity. He was, however,
sixty-eight years of age.
361. In wounds of the heart, all extraneous matters should be
removed, if possible, and all inflammatory symptoms should be
subdued by general bleeding, by leeches, by calomel, antimony,
opium, etc. The chest should be examined daily by auscultation. If
the cavity of the pleura should fill with blood, it ought to be
evacuated to give a chance for life, and if the pericardium should
become permanently distended by fluid, it should be evacuated.
Lacerations and ruptures of the heart have frequently taken place
from blows or other serious contusions.
Ollivier, who devoted much time to reading and collecting the
observations made by different writers on the injuries of the heart,
says: “That of forty-nine cases of spontaneous rupture of the heart,
thirty-four were of the left ventricle, eight only of the right, two of
the left auricle, three of the right, and that in two cases both
ventricles were torn in several places; and that these results were in
an inverse proportion to those which occurred after blows or
contusions; the right ventricle being ruptured in eight out of eleven
cases, the left ventricle three times; the auricles being also torn in
six of these eleven cases; the ruptures not being confined to one
spot, but taking place occasionally in several different parts, or even
in the same ventricle.” In eight of these cases he had noticed, the
heart was ruptured in several places. That a spontaneous rupture
may be cured as well as a wound, seems likely, from a case reported
by Rostan, of a woman who died after fourteen years’ suffering with
pain about the heart, and was found to have the ventricle ruptured.
A cicatrix was observed to the left side of the recent rupture, half an
inch in extent in every direction, in which the new matter was
evidently different from the natural structure of the heart.
LECTURE XXVI.
WOUNDS OF THE INTERNAL MAMMARY ARTERY, ETC.
362. Wounds of the internal mammary and intercostal arteries have
so much occupied the attention of theoretical surgeons, and so
many inventions have been broached for the suppression of
hemorrhage, particularly from the latter, that it becomes consolatory
to know that bleeding from these vessels rarely takes place; that the
inventions are more numerous than the case requiring them, and
that no notice need be taken of them, they being as unnecessary as
they are useless. I have never had occasion to see a distinct case of
hemorrhage from an internal mammary artery, but if bleeding should
take place from a wound in its neighborhood, of a nature to lead to
the belief that it came from this vessel, the wound should be
enlarged until the part whence the blood flows can be ascertained,
when, if it be from that artery, the vessel should be twisted or
secured by ligatures, and if these methods should be impracticable,
the wound should be closed and the result awaited.
The following method of operating for the application of a ligature
on this vessel has been proposed by M. Goyraud. It may be done
with ease in the three first intercostal spaces, it offers some
difficulties in the fourth, is very difficult in the fifth, and is scarcely to
be done lower down. An incision two inches in length is to be made
near the side of the sternum from without inward, at an angle of
forty-five degrees with the axis of the body. The middle of this
incision should be three or four lines distant (a quarter of an inch)
from the bone, and in the center of the intercostal space, within
which the vessel is to be found. The skin, cellular substance, and the
great pectoral muscle having been divided, the aponeurosis of the
external intercostal muscle with the muscular fibers of the inner
intercostal muscle are to be separated and torn through with a
director, until the artery and its two venæ comites are laid bare at
the distance of three lines from the edge of the sternum, lying
before the fibers of the triangularis sterni muscle, which separates
these vessels from the pleura. A bent probe, or other proper
instrument, can then be readily passed under the artery. The vessel
can only be secured in this way when injured at the upper part of
the chest; below this it must bleed into the cavity, unless there be an
open wound.
363. The intercostal artery, although often injured, rarely gives rise
to hemorrhage so as to require a special operation for its
suppression; but whenever it does so happen, the wound should be
enlarged so as to show the bleeding orifice, which should be secured
by one ligature if distinctly open, and by two if the vessel should
only be partially divided. The vessel is sometimes so small as to be
easily twisted, or its end sufficiently bruised as well as twisted, to
arrest the hemorrhage. It lies between the two layers of intercostal
muscles, and in the middle of the ribs it runs in a groove in the
under part of each.
I have had occasion to twist and bruise the end of an artery bleeding
in an intercostal space, and I have tied the vessel under the edge of
the rib; but I have not met with any of the great difficulties usually
said to be experienced in suppressing a hemorrhage from this artery,
when the wound was recent, and the parts were sound; no reliance
should be placed on the hypotheses often entertained on this
subject.
When the parts are unsound, and the hemorrhage is secondary,
greater difficulty is sometimes experienced in arresting it, because
the ligature easily cuts its way through the softened parts, and
styptics are liable to fall into the cavity of the chest.
The late General Sir G. Walker, G.C.B., after scaling the wall of
Badajos, with the fifth division, was wounded by a musket-ball,
which struck the cartilages of the lower ribs of the right side, broke
the bones, penetrated the chest, and then passed outward. He
remained in Badajos under my care during the first three weeks,
with many of the other principal officers who were wounded; and
overcame the first inflammatory symptoms in a satisfactory manner.
After I left him the wound sloughed, some part of the cartilages
separated, and one of the intercostal arteries bled, although the
bleeding was arrested once by ligature, and afterward, on its return,
by different contrivances; each time it reappeared his life was placed
in considerable jeopardy from it and the discharge from the cavity of
the chest, which was profuse. The bleeding was ultimately arrested
by the oil of turpentine, applied on a dossil of lint, and pressed on
the bleeding spot by the fingers of assistants until the hemorrhage
ceased. He recovered after a very tedious treatment, with a
considerable flattening of the chest, and a deep hollow at the lower
part of the side, whence portions of the rib, and of the cartilages
had been removed.
A young man, aged fifteen, was wounded by small shot in the chest,
between the first and second ribs, and near the sternum, at the
distance of about forty-eight paces. He ran about six hundred paces,
fell, and died thirty-eight hours afterward. On opening the injured
cavity of the thorax, it was found to contain twenty-eight ounces of
blood, the lung having collapsed to one-fourth its natural size. An
opening on its upper part corresponded to the external one in the
paries; but the track of the shot could not be traced into its
substance for more than two inches and three-quarters; a lacerated
spot was, however, perceived at the lower edge of the sixth rib,
about two inches from its head, at which part the intercostal artery
was found to be torn through; the shot could not be found, and
there was no opening in the skin behind.
The discussions which took place on this case led to the statement
of an anatomical fact—that when a man is standing erect, a line
drawn horizontally from the upper border of the second rib in front
would touch the upper edge of the fifth rib behind, and that very
little inclination, viz., an inch and a half, was necessary to make the
shot wound the intercostal artery of the sixth. Auscultation would
have made known the extravasation, and relief might have been
given by an incision over the spot where uneasiness was felt; for the
loss of blood was not sufficient of itself to destroy life, unless some
other injury had been sustained, which was not perceived.
364. Wounds of the neck which are made with swords, or by knives
or razors, by persons attempting to destroy themselves, are to be
treated on two great principles. The first is, not to place the parts in
contact until all hemorrhage has ceased, lest the patient be
suffocated. In the mean time, while any oozing continues, a soft
sponge should be placed between the edges of the cut. When the
larynx or trachea is obstructed by a quantity of blood, it may be
sucked out, or drawn up by an exhausting pump, and it may be
advisable in some cases to introduce a tube. If the trachea be cut
across, a stitch will be necessary to keep the ends in contact. The
second is, to keep the divided parts in contact afterward, by position
and bandage, but not by suture. If the œsophagus be wounded,
nourishment should be administered by a gum-elastic tube
introduced through the nares into the stomach. It is almost
unnecessary to add that the artery, if wounded, should be secured
by ligature. A hole in the internal jugular vein may be closed by a
thread passed around it when raised by a tenaculum.
Captain Hall, of the 43d Regiment, was wounded by a ball which
passed between the upper part of the back of the larynx and the
termination of the pharynx, without causing much further
inconvenience than the loss of voice. In this instance it must have
been the superior laryngeal nerve that was injured, and not the
recurrent, yet the voice could only be heard in a whisper, and was
not completely recovered for years. If a ball should lodge in the
trachea, it must be removed by the operation of laryngotomy or
tracheotomy, if the original wound cannot be enlarged; although
Birch, says Christopher Wren, hung up a man wounded in this way
by the heels, when the ball dropped out through the glottis and
mouth. General Sir E. Packenham, who was killed at New Orleans by
a ball which went through the common iliac artery, had been twice
shot through the neck in earlier life. The first shot, which went
through high up from right to left, turned his head a little to the
right. The second shot, from left to right, brought it straight. My kind
and excellent friend had ever afterward a great respect and regard
for the doctors and a strong feeling for the wounded. The
recollection of that regard, and the advantages derived from it, have
made me sometimes think it might be advantageous for the
unfortunate as well as for the doctors if every general could be at
least shot once through the neck or the body, before he was raised
to the command of an army in the field; for there is nothing like
actual experience of suffering to make men feel for their fellow-
creatures in distress. A Minister at War would not perhaps be the
worse for a little personal experience in this matter.
365. Wounds of the face made by swords or sharp-cutting
instruments should be always retained in contact by sutures. When
the cut is of small extent, and not deep, the skin only should be
included by the thread, and that in the slightest possible manner,
and the part supported by adhesive plaster and bandage. When the
cheek is divided into the mouth, one, two, or more sutures may
require to be inserted more deeply, but the deformity of a broad
cicatrix will in general be avoided, by carefully sewing up the whole
line, taking the very edge of skin only; and a cut in the bone or
bones of the cheek should not prevent the attempt being made to
unite the external wound over it.
Incised or even lacerated wounds of the eyelids and brows should be
united by suture, as far as can possibly be done in the first instance,
by which a subsequent painful operation may be avoided; great care
should be taken in doing this; the suture must be inserted through
the eyelid, and a leaden thread is often the best, the first being
introduced at the very edge of the lid, and two, or as many more
afterward as may be necessary. They may remain for three or more
days, as circumstances seem to require. If the eye be wounded, any
part protruding beyond the sclerotic coat should be cut off with
scissors; but the eye, however injured, should not be removed
unless the ball be detached in every direction, or destroyed. The
treatment should be strictly antiphlogistic, in order to prevent
suppuration of the eyeball, which may in general be effected, if too
much injury have not been done to it, and if the treatment be
sufficiently decided and well continued. These observations apply to
the nose and ears, and all parts not actually separated—or, if
separated, for a short time only—should be replaced in the manner
directed, and every attempt made to procure reunion. If this should
fail, surgery may yet be able to yield assistance by replacing the loss
by a piece of integument dislodged from the neighboring parts—a
proceeding requiring a separate consideration. Injuries from musket-
balls are often attended by considerable laceration, particularly when
near the eyelids. Whenever this occurs, the parts likely to adhere
should be brought together by suture, after any splinters of bone
which may present themselves, or can be seen or felt, have been
removed from the holes made by the ball. If the bones should be
broken, and not splintered, they will frequently reunite under proper
management.
366. Wounds of the eye from small shot are remediable when these
small bodies lodge in the cornea or sclerotica, whence they may be
removed by any sharp-pointed instrument. When a shot or piece of
a copper cap is driven through the cornea, into the iris, or lies in the
anterior chamber, it should be removed by an incision to the extent
of about one-fourth or one-fifth of the cornea, near its junction with
the sclerotica, but in these cases a cataract, if not amaurosis,
frequently results. When the shot passes through all the coats of the
eye, it can neither be seen nor removed with safety; vision will be
lost, much pain may be endured, and the eye will frequently be
destroyed by suppuration, or by a gradual softening, and ultimate
diminution in size. A contused wound from a large shot which only
injures the coats of the eye, but does not perforate them, will
oftentimes be cured by a proper antiphlogistic treatment, which in all
cases should be most strictly enforced, although loss of sight is a
frequent consequence after such injuries.
When a ball lodges behind the eye, it usually causes protrusion,
inflammation, and suppuration of that organ. If it be not discovered
by the usual means, its lodgment may be suspected from the
gradual protrusion and inflammation of the eye itself. If it be
discovered, it should be removed together with the eye, if such
proceeding be necessary for its exposure. If suppuration have
commenced in the eye, a deep incision into the organ will arrest, if
not prevent, the horrible sufferings about to take place, and allow of
the removal of the offending cause. If the eye remain in a state of
chronic disease and suffering, a similar incision will give the desired
relief. If the chronic state of irritation affect the other eye, the
incision and sinking of the ball of the one first affected or injured is
urgently demanded, and should not be delayed. If the back part of
the eye be left with the muscles attached to it, a stump remains,
against which an artificial eye may be fitted, so as sometimes to
render the loss of the natural one almost unobservable.
367. I have several times seen both eyes destroyed and sunk by one
ball, with little other inconvenience to the patient; one eye sunk, the
other amaurotic, and both even amaurotic, almost without a sign of
injury, by balls which had passed from side to side through both
orbits, but behind the eyes. When the eye becomes amaurotic from
a lesion of the first branch of the fifth pair of nerves, the pupil does
not become dilated; the iris retains its usual action, although the
retina may be insensible and vision destroyed. This was well shown
in the case of the late Major-General Sir A. Leith, who was wounded
by a sword in the forehead, this nerve being divided. It has so often
occurred as to leave no doubt of the fact, and of the error formerly
existing on this point.
368. Penetrating wounds implicating the bones of the face are
always distressing. When the bones of the nose are carried away,
there must always be some deformity remaining, although there is
oftentimes but little suffering. When these bones are merely
splintered and depressed, great pains should be taken to keep them
properly elevated. If the duct of the parotid gland be implicated by
an incised wound, care should be taken to divide the cheek into the
mouth, if it should not have been already done, and to keep the
incised wound open until the external one is closed. If a salivary
fistula have formed externally, from inattention or otherwise, it must
be treated according to the ordinary methods adopted in such cases.
When a wound of the gland itself becomes fistulous, and weeps,
which is a rare occurrence, it will be best treated by actual or
potential cauterization, if moderate pressure should fail. When these
wounds are of some extent, they are often followed by partial
paralysis, in consequence of the seventh pair of nerves being
injured, when the mouth is drawn somewhat to the other side.
When the lachrymal bones or sac are injured by balls or swords, the
tears usually continue through life to run over, and give
inconvenience, although much good may be done by early attention
to the injuries of this part. Wounds injuring the upper jaw are
oftentimes followed by much suffering, and by permanent
inconvenience.
General Sir Colin Halkett, G.C.B., was wounded on the 18th of June,
at Waterloo, when in front of his brigade, which was formed in
squares for the reception of the French cavalry, by a pistol-ball, fired
by the officer commanding them, which struck him in the neck, and
gave him great pain, but without doing much mischief. A second
shot shortly afterward wounded him in the thigh, and he was obliged
to leave the field toward the close of the day, by a third musket-ball,
which struck him on the face, when standing sideways toward the
enemy. It entered a little below the outer part of the cheek-bone on
the left side, and, taking an oblique direction downward and
forward, shattered and destroyed in its course several of the double
teeth in the upper jaw, fracturing the palate from its posterior part,
forward to the front teeth. The ball then took a direction obliquely
upward, destroying the teeth of the opposite side of the upper jaw,
which bone it also broke, and lodged under the fleshy part of the
cheek. These wounds gave great pain, and until the ball was
removed, the left ear was totally insensible to sound and all external
impressions, although the general suffered much from distressing
noises in his ear. These subsided on the removal of the ball some
days afterward.
The treatment of this wound, however, was most painful; the
extraction of several pieces of bone was necessary at different times,
during the three following years, before the wounds were finally
closed. Considerable derangement of health followed, the deafness
remains; and the general has ever since been subjected to attacks in
the head of an increasing and most distressing nature.
369. Wounds of the lower jaw are perhaps more common, and are
certainly more troublesome than those of the upper; they are more
difficult of management, and, for the most part, end in greater
deformity, unless particular care be taken to prevent it, and then
only in very severe cases, by operations which were formerly not in
use, but which the intrepidity of the surgeons of the present day
have deprived of all their terrors. I mean the methodical division of
the soft parts, the sawing off and removal of the broken pieces of
bone, and the rounding off of those parts of the jaw which may
remain irregular and pointed. M. Baudens has given two good
examples of the success of this proceeding during his campaigns in
Algeria. In the first case, the ball entered at the middle of the left
cheek, and came out by the side of the spinous process of the
seventh cervical vertebra. The ascending ramus of the lower jaw was
broken into numerous splinters. M. Baudens divided the soft parts
down to the bone, entering the straight bistoury four lines, or the
third of an inch, below the articulation of the jaw with the temporal
bone. He then carried it downward, and a little obliquely forward, so
as to terminate it in the fibers of the masseter muscle, about half an
inch below the base of the bone. This incision was begun below the
seventh pair of nerves, and exposed the parotid gland divided
vertically at its middle part. The splinters were removed, a part of
the pterygoideus internus muscle was divided, and a projecting point
of bone attached to it sawn off. He then separated the attachments
of the buccinator, temporal, and pterygoideus externus muscles,
divided the ligaments, and removed the coronoid and articulating
processes, taking care to avoid the fifth and seventh pairs of nerves.
The bleeding from two arteries was suppressed by twisting their
ends; and the parts were afterward brought together by sutures,
which remained for eight days. A month after the operation the
patient ate solid food, and in six weeks was cured. In the second
case, the ball entered near the left commissure of the lip, and came
out behind on the side of the middle of the neck; three inches of the
jaw were splintered, the ends of the bone being sharp and angular.
In order to remove the splinters, and to prevent the evils
anticipated, M. Baudens divided the lip from the angle downward
and outward, below the base of the bone, as far back as the edge of
the masseter muscle. He then separated the flaps, and sawed the
jaw across, first near the symphysis, and then behind, outside the
attachment of the masseter. The facial artery was twisted, four
sutures were inserted, and the jaw duly supported. The patient was
bled twice, and in six weeks was cured; at the end of that time he
could eat solid food. After the healing of such wounds, mechanical
means are often necessary to enable the sufferer to eat and to live
without causing disgust to his neighbors and his friends.
It is said there are fifteen men in the Hôtel des Invalides, in Paris,
wearing silver masks on the lower part of their faces, in
consequence of injuries of this kind.
Colonel Carleton was an instance of a ball fracturing the jaw directly
through its body, near where the masseter muscle is attached on
both sides; the jaw was broken into three pieces, besides splinters;
several teeth were knocked out, and the tongue very much hurt. By
sawing off the splinters both from within and without, and by
cleansing and supporting the parts with great care, he recovered
after a length of time, the deformity after such a wound being much
less than might be expected.
370. Incised wounds of the tongue do sometimes give rise to
hemorrhage somewhat difficult to restrain, particularly if it occur a
few days after the receipt of the injury, when the tongue is swollen
and painful. It does not so frequently occur after gunshot wounds.
As the vessels of one side do not communicate with those of the
other, any bleeding which continues after the artery of one side has
been properly secured, can only take place from a wound of the
artery of the other, which must then also be tied. This should be
done by drawing the tongue as far as possible out of the mouth by a
flat pair of forceps, which may be easily effected at an early period,
when it is not tender and painful. At a later date, and under difficult
circumstances, various styptics, such as the mineral acids, nitrate of
silver, etc., will be useful. The actual cautery has been
recommended, but I have never seen it used in such cases.
371. One of the most curious instances of the lodgment of a foreign
body in the face occurred in the person of Captain Fritz, at Ceylon;
his gun burst in his hand, and drove the iron breech into the
forehead, whence it descended into the nares, and, at the end of a
year, part of it made its appearance in the mouth, through the
palate. He died eight years afterward, having suffered much
inconvenience from the offensive discharge it occasioned. When the
iron was removed, it had obviously injured no part of any material
importance to life. I have seen balls descend in this way into the
throat and soft palate, and have removed them from both places
with success, and from the hard palate with equal surprise and
advantage to the patient. I have known a ball lodge in the superior
maxillary sinus for months, and even for years, before it was
removed, or the death of the patient proved the fact.
LECTURE XXVII.
STRUCTURE OF AN INTESTINE, ETC.
372. If an intestine be divided circularly in any part, its walls will be
found to be composed of three principal coats or tunics, which are—
commencing from the inside—the mucous, the muscular, and the
serous or peritoneal, each being separated from the other by a layer
of areolar tissue. A diagram thus made would show a transverse
division of the intestine, and eight distinct if not all different parts.
Beginning from without, viz., serous or peritoneal, areolar or sub-
serous; longitudinal muscular, areolar; transverse muscular, areolar
or sub-mucous, and epithelial. The mucous coat in man has a
peculiarity not observable in animals, of ledges or shelves projecting
into its cavity.
When the mucous coat of the duodenum is examined with the naked
eye, the first part of its course presents a tolerably smooth
appearance, gradually, however, becoming irregular in transverse
folds, which are so numerous, marked, and regular in the jejunum
and ileum as to have obtained from the earliest times the name of
valvulæ conniventes. They are most strongly marked in the jejunum,
and gradually disappear toward the lower part of the ileum, the
inner surface of the large intestines being still smoother than any
part of the small, although large pouches or cells are formed in the
colon by a peculiar arrangement of the muscular coat. These valves
never extend completely round the inside of the intestine, and rarely
more than half or two-thirds, although they sometimes bifurcate.
They have a velvety appearance, which has obtained for this coat
the name of villous as well as that of mucous.
Valvulæ conniventes are peculiar to man; none exist in the ourang-
outang or chimpanzee. In the frog there are valvular folds,
appearing, at first sight, like the valvulæ conniventes of the human
subject; but, on a careful examination, they are found to be mere
elevations, without villi. In the tortoise there are similar folds,
running however in a longitudinal or opposite direction. In the
rhinoceros the mucous membrane is raised up into villiform
processes, somewhat like the valvulæ conniventes, or large villi; but
they are not villi, as each process is covered with other projections
which really are villi. A valvula connivens consists of two layers of
mucous membrane and sub-mucous tissue, but the muscular coat is
not continued into it.
373. When examined microscopically, the velvety appearance is
found to consist of innumerable small processes which have been
called villi, each villus being composed principally of a very thin,
transparent basement or germinal membrane, forming a sheath or
case, inclosing within it an artery, a vein, a capillary plexus, and an
absorbent vessel termed lacteal. A nerve has not been discovered,
although it is presumed to exist. These villi are longest in the
duodenum, and gradually diminish in number and in size from 1/25
to 1/50 of an inch. Between these villi or projections, holes or
openings are observable, termed the follicles of Lieberkühn, who
first described them; they resemble inverted villi, being in some
instances as deep as the villi are long. Unlike the villi, they are found
throughout the intestines. The villi in every part in common with all
mucous membranes are covered, and the follicles are lined by
epithelium, which in this instance is the columnar, situated on the
basement membrane, each column being attached by its pointed
extremity. A layer of this epithelium extends between the villi, down
to the lower part of each follicle, each column being, generally
speaking, shorter and rounder than when covering the villi.
The office of the epithelium of the villi has been stated to be
protective, that of the follicles to be secretive. A villus, when duly
magnified, is seen to have a bulbous extremity without an opening,
and to be covered by epithelium when the intestine is in a state of
quiescence, uncalled upon for any purpose of digestion. When
digestion commences, the epithelium, according to the researches of
Mr. Goodsir, is separated and thrown off. As the chyme begins to
pass along the small intestine, an increased quantity of blood
circulates in the capillaries of the gut. In consequence of this
increased flow of blood, or from some other cause, the internal
surface of the gut throws off the epithelium of both villi and follicles,
which is intermixed with the chyme in the cavity of the gut. The
cast-off epithelium, forming 19/20ths of the covering of the villus, is
of two kinds, that which covers the villi, and which from the duty it
performs may be termed protective, and that which lines the follicles
and may be termed secretive, each column having a nucleus
situated at some part of it, and bulging out that part.
The villi being now turgid with blood, erected and naked, and
covered by the chyme mingled with the cast-off epithelia, commence
their functions. The summit of the villus becomes at first somewhat
flattened and crowded under the basement membrane with a
number of newly-formed and perfectly spherical vesicles, varying
from 1000 to less than 2000 of an inch in size. Toward the body of
the villus or the inner edge of the vesicular mass, minute granular or
oily particles are situated in great numbers, and gradually pass into
the granular texture of the substance of the villus. As the process
advances lacteal vessels are shown passing up from the root of the
villus, subdividing and looping as they approach the spherical mass,
which in this stage has become more distinctly vesicular, although no
distinct communication can be detected between them. The blood-
vessels and capillaries shown in injected preparations are now seen
colored red with their own blood, and running up to the basement
membrane, looping with each other immediately beneath it, and
ending in one or more venous trunks. The vesicles, quite distended
and grouped in masses, push forward the membrane, and give to it
by these inequalities an appearance resembling that of a mulberry.
The minute vesicles above noticed fulfill the important office of
absorption, by drawing into their cavities through their walls, by a
process called endosmosis, that portion of the chyme necessary to
form chyle; when filled with it they burst or dissolve, their contents
being thus discharged into the texture or substance of the villus, fit
to be taken up by the granular vesicles interspersed among the
terminal loops of the lacteals, and communicating with their trunks,
running up from the root of the villus in their center. Absorption is
thus shown to be effected by closed vesicles, and not by vessels
opening on the surface of the villus.
The débris and the contents of the dissolved chyle cells, etc. pass
into the looped net-work of lacteals, as in other lymphatics. When
the gut contains no more chyme, the flow of blood to the mucous
membrane diminishes, the development of new vesicles ceases, the
lacteals empty themselves, the villi become flaccid, and the cast-off
epithelium is reproduced, apparently from the nuclei in the
basement membrane, in the intervals of digestion, showing that this
function should only be induced at regular periods, the presumed
special use of the epithelium being to prevent, in a measure, the
absorption of any effete or other matters which might exert a
deleterious influence oh the system, the epithelium of the follicles
now secreting a mucus which may be considered protective.
In the large intestines there are no villi, but the whole surface is
covered with follicles which must be capable of absorbing as well as
of secreting, as it is ascertained that persons can be nourished and
kept alive for many weeks by nutritious enemata which do not pass
into the small intestines.
374. On examining the mucous membrane of the stomach, its
follicular structure is immediately seen, the follicles resembling much
in appearance those of the intestine; but in the stomach minute
tubes are found opening into the bottom of each follicle, fulfilling in
all probability a different office, the follicles being lined by columnar
epithelium, the tubes by spheroidal or glandular epithelium; it is
therefore presumed that the gastric juice is secreted by the tubes,
the mucus by the follicles. The tubes differ in the middle and lower
parts of the stomach, by being longer or more deeply seated, and
more numerous as they approach the pylorus, showing in all
probability a difference of function between the upper and middle,
and the pyloric or lower extremity of the organ.
The intestines are supplied with glands, not apparently for the
purposes of absorption, but of secretion; these require attention.
They are the duodenal of Brunner, the agminated of our
countryman, Nehemiah Grew, and of Peyer, and the solitary, which
are found in the lower part of the small and in the whole course of
the large intestines.
The glands of Brunner are situated at the commencement of the
duodenum, within an inch of the pylorus, and are not visible until
the serous and muscular coats have been removed from without.
They appear to the naked eye like the little white eggs of an insect.
Under the microscope each little gland is found to be lobulated, very
much resembling a small portion of a salivary gland or pancreas,
each lobule having an excretory duct, which unites with those from
other lobules to form one larger one opening on the mucous surface
of the bowel. The lobules themselves are made up of vesicles, within
which the secretory cells are discernible.
The agminated glands of Grew and Peyer, by the latter of whom
they were more minutely described, occur in oval patches at
irregular distances throughout the jejunum and ileum, and are
situated on the side immediately opposite the part where the
mesentery is united to the bowel. Each gland resembles somewhat a
Florence oil-flask in shape, the small end or mouth, which is more or
less pointed, projecting through among the villi or the follicles. They
are composed of cells, supplied by capillary vessels, which Mr.
Quekett says have the peculiarity of being unsupported by areolar
tissue, and are termed by him, in consequence, naked. These are
the glands which are found more or less diseased after phthisis and
fevers which have terminated fatally. The oval form of the patches is
retained, although considerably raised above the general surface of
the mucous membrane, and when injected the parts around are
more vascular, the ulcerated portion being less so than usual.
The solitary glands are best seen in the cœcum and appendix
vermiformis. They are well developed in the fœtus, projecting
slightly above the mucous membrane. Each gland may be
considered as one of the agminated form much enlarged, and when
the free surface is very flat, an opening may be easily seen in the
center. These glands also are frequently the seat of ulceration in
fever and dysentery, and particularly in phthisis. The follicles partake
of this disease, and the whole mucous coat may be destroyed. In
some cases there is an attempt at healing, and the edges of the
ulcers become more vascular and even villous.
The sub-mucous areolar tissue—the tunica nervosa of Haller, the
fibrous lamella of Cruveilhier—separating yet connecting the mucous
with the muscular coat of the intestine, is composed of the yellow
elastic and of the white or non-elastic fibers, the latter of which
predominate. It is more firmly connected with the mucous than with
the muscular coat, and in it the blood-vessels and nerves are
supported prior to their distribution in the mucous membrane. This
sub-mucous tissue or structure prevails also in the stomach, and is
often much altered by disease, becoming thicker, and assuming a
more dense and sometimes an almost gristly hardness. It is an
important part in the surgical treatment of wounds of the intestines,
being firmer, stronger, and more elastic in reptiles, and more distinct
in carnivorous than in herbivorous animals or in man.
375. The muscular coat of the intestines is in two layers, the internal
being composed of fibers running transversely, the outer fibers
running longitudinally; they are thickest in the duodenum and
rectum. They are of the involuntary or unstriped kind, as opposed to
the voluntary or striped, which are of large size, and characterized
by striæ running transversely and longitudinally.
The involuntary fibers, on the contrary, are much smaller in size, are
always more or less flattened, and present no trace of striæ or
stripes, although the interior appears granular, with an occasional
nucleus. The heart is a remarkable exception to this rule, being an
involuntary organ, with striped fibers differing in size, resembling in
this respect those of a voluntary muscle.
The peritoneal coat is formed of the white fibers, under a
structureless or basement membrane, covered by tesselated
epithelium, constituting a serous and secreting membrane.
376. Wounds and injuries of the abdomen are essentially of three
kinds—1. Affecting the paries or wall. 2. Opening or extending into
its cavity. 3. Wounding or injuring its contents.
The wall of the belly is, when severely hurt, liable to a permanent
defect, as the ordinary result of a severe bruise. It is the formation
of a ventral rupture. A division of the wall to any extent by a sharp-
cutting instrument is usually followed by a similar consequence; and
it never fails to occur in the openings made by a musket-ball
penetrating into or passing through the cavity.
Captain Tarleton, of the 7th or Royal Fusiliers, was struck on the left
iliac region by a large, flat piece of shell, at the battle of Albuhera, in
1811. The surface was not abraded, although the iron caused a very
severe and painful bruise; the whole of that side of the belly became
quite black, and the remaining part much discolored. Some months
afterward he drew my attention to the part, and I then found that
the whole of the muscular portion of the wall had been removed by
absorption to the extent of the immediate injury from the piece of
shell, the tendinous parts alone remaining under the integuments.
These protruded on any effort, constituting a circular-shaped ventral
rupture, with a large base, which required the application of a pad
and bandage for its repression.
Mr. Smith, a deputy-purveyor, received a blow on the side of the fore
part of the belly from the end of a spanker-boom, which knocked
him down, and gave rise for some time to much inconvenience. He
showed the part to me in Lisbon, in 1813, in consequence of the
formation of a ventral hernia to the extent of the spot originally
injured. In neither of these cases was such a result expected; no
rupture of the fibers of the muscles was distinguished at the time,
and it was supposed that the sufferers would recover without any
permanent defect. The absorption of the muscular fibers was
therefore a subsequent process; whether this result may or may not
be prevented in similar cases by a more active or a longer-continued
treatment, with the early application of a retaining bandage, is yet to
be ascertained. It may be that some muscular fibers were actually
ruptured and others bruised in these cases; but the extent of the
absorption was greater than the apparent injury would seem to have
warranted.
Abscesses form from neglected injuries of this kind, and give rise to
the most serious apprehensions of their bursting into the cavity of
the abdomen, which, however, they very rarely do. The safety of the
peritoneum and its capability of affording sufficient resistance to the
progress of the matter through it seem to depend upon the strength
of the fibrous structure on its outer or muscular side; the inner or
really serous surface being very delicate, and offering but little
resistance to the application of any moderate degree of force.
An officer, whose name I forget, was wounded at the assault of
Ciudad Rodrigo, in 1812, by a musket-ball, on the left side and fore
part of the abdomen, near the crest of the ilium: it made a wound
about four inches in length, cutting away the muscles of the
abdominal wall so deeply as to lead to the exposure, and, as I
feared, to the ulceration of the peritoneum, when the sloughs should
separate. Under these circumstances, although not belonging to my
division, I took him with me from the field to the divisional hospital
at Aldea Gallega, some ten miles from the battlefield. Granulations
sprang up, however, from the bottom and sides of the wound, which
gradually closed in and healed without further difficulty.
377. It has been supposed theoretically, to be a matter of
importance to discriminate between the orifice of entrance of a ball
passing through the abdomen or its wall, and that of its exit.
Practically speaking, it is a matter of indifference; the part on which
the ball impinges is usually distinguished by a more circular and
depressed appearance, while the opening of exit more frequently
resembles a tear or slit, the edges of which are rather disposed to
protrude.
A ball striking obliquely against the wall of the abdomen has been
said to run sometimes nearly round under the skin, or between the
muscles and the peritoneum, a proceeding upon the recurrence of
which little expectation need be placed. It may, however, do
something of the kind for a considerable distance, passing even over
or between the spinous processes of the vertebra behind. In such
cases, when they actually occur, the course of the ball will usually be
marked by a line on the skin, more or less of a reddish-blue color;
and the constitutional alarm, if it should occur at all, will subside
early. A ball may, however, pass under and between the muscular
layers of the wall of the belly, (or run nearer to the peritoneum for
several inches,) giving rise to great anxiety, until the sloughs have
separated from the openings of entrance and of exit, at which parts
they prevail to a greater extent than in the middle of the track of the
projectile. In some few instances an opening will require to be made
in the middle of this track or course of the ball, for the evacuation of
pus or of other extraneous matters which may be detained in it.
When a ball lodges in the wall of the abdomen and is deeply
situated, it sometimes escapes notice, and when found is often
better left alone unless it prove troublesome. When it approaches
the surface, it may be removed if it cause inconvenience. When
removed after the lapse of twenty or more years, I have found some
dense cellular membrane forming a sac around and adhering to the
ball, which is usually more or less flattened and irregular.
378. Injuries of the wall of the abdomen from cuts or stabs affecting
the muscular and tendinous parts are said to be frequently
troublesome, and even dangerous, from their giving rise to pain,
vomiting, and severe general derangement. This only occurs when
suppuration takes place, and, from some accidental circumstance,
the matter does not find a ready exit, but collects between the
muscles, or within or under their aponeurotic sheaths. This is
indicated by the pain and swelling of the part, proceeding sometimes
to the formation of an abscess, which ought to be prevented, if
possible, by an early enlargement of the wound, so as to remove the
cause of irritation, and the obstacle to the free discharge of the
secreted matter. If the swelling should become prominent in a more
convenient situation than the spot of injury, it should be opened at
that part.
In these and in all other serious injuries of the abdomen, the
recumbent position, with a relaxed state of the muscles, should be
observed for several days at least. The antiphlogistic plan of
treatment should be fully enforced, especially by leeching, bleeding,
and spare diet, and in due time the part should be supported by a
proper bandage.
The late General Sir John Elley was wounded in the last charge of
heavy cavalry at Waterloo, by the point of a sabre, which entered
nearer the extremity of the ensiform cartilage than the umbilicus,
causing a wound about two inches in length, penetrating the
stomach. From this he recovered in due time without any severe
symptoms, but with a small hernia of that organ, which remained
until his death, giving rise occasionally to some gastric inconvenience
when he did not keep a gentle pressure on it by a retaining
bandage.
379. Severe blows, or contusions from falls or from the concussion
of foreign bodies, may give rise not only to injury of the internal
parts of the abdomen, followed by inflammation, but to rupture of
the hollow as well as of the more solid and fixed viscera, and death.
William Fletcher, of the 18th Hussars, a healthy man, thirty-seven
years of age, received a kick from a horse, immediately above the os
pubis, on the 15th of April, 1810, (about a league from Cartaxo, on
the Tagus;) great tension of the belly soon followed, with excessive
pain and vomiting. The pulse rose rapidly. He was bled to syncope
twice during the day, to the extent of sixteen ounces each time. In
the evening he was removed to Cartaxo, and taken into hospital; the
pain continued, accompanied by retching, without much vomiting;
the abdomen was constantly fomented with hot water, and injection
was thrown up, and two ounces of infusion of senna with salts were
given every two hours. In spite, however, of the most active
treatment, he died on the 17th. On dissection, the peritoneum was
found to contain a large collection of fluid, partaking of a fecal
character; the bowels appeared to have suffered to the greatest
extent, and a laceration was discovered in the ileum.
A child, just able to walk, was placed under my care in the
Westminster Hospital, in consequence of its having received some
injury on the side of the belly, from having been tossed up into the
air by its father with his right hand, and caught in its descent in the
crutch formed by the thumb and fingers of the left, on the thumb of
which it unfortunately at last fell; this caused the child great pain,
which was soon followed by considerable swelling and inflammation
of the belly, of which it died. On examination after death, the small
intestine was discovered to have been ruptured by the end of the
thumb, from which extravasation of its contents into the abdomen
had ensued.
The first effect of a rupture of the intestine must be the
extravasation of such gas as may be contained in or secreted from
it, giving rise to the sudden swelling, as well as to the sudden
effusion, of part of its contents, but which, from the support of
continuity, and of the general pressure of the abdominal parietes, is
perhaps more gradually poured out. The rapid swelling and tension
of the belly is perhaps then a distinguishing symptom of a rupture of
the intestines.
A Spanish soldier was brought to me, near the conclusion of the
battle of Toulouse, in consequence of having been struck obliquely
by a cannon-shot on the right side of the abdomen and back, which
appeared to be badly braised, although no abrasion of the skin had
taken place. The shock was great, however; he was unable to move
his limbs, and appeared likely to die, which he did in fact, in the
course of the night, having passed bloody urine, but without any
reaction having taken place. On making an incision through the skin,
which was then quite a blue black, although not torn, all the soft
parts were found reduced to a state approaching to the appearance
of jelly; the spine was injured, the right kidney ruptured, and the
cavity of the abdomen full of blood.
A soldier of the 40th Regiment was struck by a ricochet cannon-shot,
on the last day of the siege of Ciudad Rodrigo. He saw the ball,
which destroyed his left forearm so as to render amputation
necessary, strike the ground a little distance from him, before he
was himself injured. He thought, from the sort of shock he received,
that it had also struck his belly; but this I should not have credited,
if it had not been for a bruise across the umbilical region without
actual abrasion of the integuments, on which account my attention
was drawn to him on the fourth day after the injury, at the hospital
of Aldea Gallega. He had been bled in consequence of complaining
of pain, and because of the quickness of pulse and the fever which
had ensued, and which were attributed to irritation after amputation.
The belly was swollen and tender under pressure. Calomel,
antimony, and opium were given: he was bled again, and blisters
were applied. The stump took on unhealthy action, and he died a
fortnight after the receipt of the injury. The abdomen, when opened,
was found to contain a quantity of opaque serous fluid, mixed with
shreds of coagulable lymph. The omentum and intestines were of a
dark color, and loaded with blood, distinctly indicating the chronic
state of inflammation which had taken place.
If the injury should not destroy the patient, but prove sufficient to
give rise, after several weeks, to effusion into the cavity, the fluid
should be evacuated by the trocar.
When the fixed viscera are ruptured by severe blows, such as those
received by falls or from cannon-shot, the sufferers usually die from
hemorrhage and not from inflammation. The arm has been carried
away, and the liver ruptured without almost a sign of injury to the
skin of the abdomen, death ensuing from hemorrhage.
380. When an incised wound is made through the wall of the
abdomen to any extent, except perhaps in the linea alba, the
muscular parts are rarely found to unite in a more perfect manner
than when they are ruptured and bruised. In those cases in which I
have tied the common iliac artery by an incision on the face of the
lateral part of the abdomen, the patients recovering afterward, the
incision through the muscular wall did not remain united, although
union appeared to have taken place in the first instance, and a
herniary protrusion formed in the course of the greater part of the
line of the wound.
The constant occurrence of this non-union, except by skin and
cellular membrane, led me to repudiate the introduction of ligatures
through other parts for the purpose of keeping them in apposition,
as it does not lead to the permanent cohesion of the parts, while it
exposes the sufferers to all the dangers which the irritation of
sutures commonly occasions, thus offering another instance of the
improvement surgery owes to the war in the Peninsula.
Chelius recommends “several flat ligatures to be introduced through
the skin and muscles, the needle being placed close to the muscular
surface of the peritoneum.” Graëfe (section 514) is declared to be of
the same opinion, he recommending, however, that a soft tape
should be substituted for a ligature. Reference is made to Weber in
support of this practice, to which Mr. South, the translator, does not
raise any objection.
381. In all simple wounds of the wall of the belly of moderate
extent, the edges of the wound should be brought together by
means of a small needle and a fine silk thread passed through the
skin and the loose cellular membrane only which is in contact with it,
by a continuous suture without puckering, in the manner a tailor
would fine-draw a hole in a coat. This gives a certain degree of
support to the parts beneath; and if proper attention be paid to
maintain a well-regulated, relaxed position of the muscles, no great
separation takes place in wounds of a reasonable extent, and little or
none in a wound of smaller dimensions. An effective support should
be also given by strips of adhesive plaster extending to some
distance around the body; a bandage rarely does good, and will
assuredly do mischief, unless it be very carefully applied and
watched, so as only to give support and not to make undue
pressure. The position of the patient is of the greatest importance;
its essential object is to bring the edges of the incision, and
especially of that in the peritoneum, as nearly as possible in
apposition, so that the space between them may be more easily
filled up by the opposing peritoneum forming the anterior layer of
the omentum, or by the outer covering of the intestine if the
omentum should not intervene. This is to be effected by the gentlest
inclination of the body toward the wound which may be supposed
capable of keeping these parts in apposition; for although the
omentum and intestines are often capable of undergoing a
considerable degree of motion from side to side, independently of
that peculiar wormlike movement on themselves which in the
intestines is called peristaltic, they very frequently do not wander
from place to place in the manner which has been sometimes
attributed to them, but remain, under proper care, so far stationary
as to admit of the cut edges of the wounded peritoneum adhering to
the healthy peritoneum opposed to them, when they will be retained
in contact with it. The serous surfaces of the peritoneum which are
in contact with each other soon offer on one part, and accept on the
other, the process of adhesion through the medium of lymph or
fibrin deposited between them. If this adhesion take place, it
extends for some little distance from the wounded part, which it
thus closes up and cuts off from all communication with the general
cavity of the belly; the previous admission of air—the bugbear of
surgeons of the olden times—being of no sort of consequence. The
adhesive process is the effect of inflammation extending to a certain
point, and ending in the deposition of fibrin. When it exceeds this,
the secretion of a quantity of serous fluid, together with threads of
flocculent matter, marks the excess of inflammation; it is diffused
over more or less of the peritoneum lining the wall of the belly,
covers its contained viscera, and prevents that adhesion from taking
place which is the safeguard of the patient.
382. Absolute quietude is no less to be observed. It must, however,
be steadfastly continued; the slightest alteration of position should
be forbidden. Motion should not on any account, nor for any reason
whatever, be allowed, if it can by any possibility be avoided. In the
position in which the patient is placed he should be rigorously
maintained until adhesion has been effected or all hope of it has
passed away. The practice of the older surgeons was to purge such
persons vigorously, in order to remove from their bowels any
peccant matters that might be in them; in the same manner they
recommended persons should be purged who had undergone the
operation for strangulated hernia—both which proceedings the
experience of the war enabled me to condemn, as being not only
contrary to the right medical treatment of such cases, but to the
physiological and surgical principles on which it ought to be founded,
a condemnation the accuracy of which is now universally admitted,
although the source from which it is derived is not so universally
acknowledged. No purgative medicine whatever should be given to a
person with a penetrating wound of the abdomen. No food should
enter his mouth; and no more water even should be allowed than
may be found requisite to moisten the lips and allay any intolerable
thirst which may ensue. This precaution need not be carried out so
strictly if it could be readily ascertained that an intestine was not
wounded; but as this knowledge, however satisfactory it would be,
cannot always be obtained, and ought not in the generality of
instances to be sought for, the restriction should be fully observed if
possible. In all cases of injury of the belly there is more or less
shock, alarm, and anxiety. It is sometimes remarkably great, even
when the mischief has not been considerable. When little or no
injury has been inflicted on the intestines, the natural and usual
action of expelling the contents is generally delayed beyond the time
at which in health it would in all probability have occurred. When
nature shall point out by the sensations of the patient an inclination
to perform this function, it may be assisted by an injection of warm
water or of any mild laxative which may facilitate the process and
prevent any unnecessary action of the abdominal muscles, against
which the patient should be cautioned. The attendants should be
forewarned that the position of the patient is not to be interfered
with under any circumstances, the necessary arrangements being
made by bedsteads of a proper construction, or by other simple
means which are sufficiently well known.
383. The custom of directing a man to be bled forthwith, as well as
purged, because he has been stabbed, was another error much in

You might also like