SlideShare a Scribd company logo
Programming PHP 4th Edition Peter Macintyre
download
https://textbookfull.com/product/programming-php-4th-edition-
peter-macintyre/
Download more ebook from https://textbookfull.com
We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!
Learn Java for Android Development: Migrating Java SE
Programming Skills to Mobile Development 4th Edition
Peter Späth
https://textbookfull.com/product/learn-java-for-android-
development-migrating-java-se-programming-skills-to-mobile-
development-4th-edition-peter-spath/
Programming Language Concepts Peter Sestoft
https://textbookfull.com/product/programming-language-concepts-
peter-sestoft/
Lumen Programming Guide Writing PHP Microservices REST
and Web Service APIs 1st Edition Paul Redmond (Auth.)
https://textbookfull.com/product/lumen-programming-guide-writing-
php-microservices-rest-and-web-service-apis-1st-edition-paul-
redmond-auth/
Programming WCF Services 4th Edition Juval Löwy
https://textbookfull.com/product/programming-wcf-services-4th-
edition-juval-lowy/
Programming in Lua 4th Edition Roberto Ierusalimschy
https://textbookfull.com/product/programming-in-lua-4th-edition-
roberto-ierusalimschy/
Pro Functional PHP Programming Application Development
Strategies for Performance Optimization, Concurrency,
Testability, and Code Brevity Aley
https://textbookfull.com/product/pro-functional-php-programming-
application-development-strategies-for-performance-optimization-
concurrency-testability-and-code-brevity-aley/
Pro Functional PHP Programming: Application Development
Strategies for Performance Optimization, Concurrency,
Testability, and Code Brevity Rob Aley
https://textbookfull.com/product/pro-functional-php-programming-
application-development-strategies-for-performance-optimization-
concurrency-testability-and-code-brevity-rob-aley/
Computer Programming and Utilization, 4e 4th Edition E.
Balagurusamy
https://textbookfull.com/product/computer-programming-and-
utilization-4e-4th-edition-e-balagurusamy/
Advanced Apex Programming in Salesforce 4th Edition Dan
Appleman
https://textbookfull.com/product/advanced-apex-programming-in-
salesforce-4th-edition-dan-appleman/
Programming PHP 4th Edition Peter Macintyre
1. Foreword
2. Preface
a. Audience
b. Assumptions This Book Makes
c. Contents of This Book
d. Conventions Used in This Book
e. O’Reilly Online Learning
f. How to Contact Us
g. Acknowledgments
i. Kevin Tatroe
ii. Peter MacIntyre
3. 1. Introduction to PHP
a. What Does PHP Do?
b. A Brief History of PHP
i. The Evolution of PHP
ii. The Widespread Use of PHP
c. Installing PHP
d. A Walk Through PHP
i. Configuration Page
ii. Forms
iii. Databases
iv. Graphics
e. What’s Next
4. 2. Language Basics
a. Lexical Structure
i. Case Sensitivity
ii. Statements and Semicolons
iii. Whitespace and Line Breaks
iv. Comments
v. Literals
vi. Identifiers
vii. Keywords
b. Data Types
i. Integers
ii. Floating-Point Numbers
iii. Strings
iv. Booleans
v. Arrays
vi. Objects
vii. Resources
viii. Callbacks
ix. NULL
c. Variables
i. Variable Variables
ii. Variable References
iii. Variable Scope
iv. Garbage Collection
d. Expressions and Operators
i. Number of Operands
ii. Operator Precedence
iii. Operator Associativity
iv. Implicit Casting
v. Arithmetic Operators
vi. String Concatenation Operator
vii. Auto-Increment and Auto-Decrement Operators
viii. Comparison Operators
ix. Bitwise Operators
x. Logical Operators
xi. Casting Operators
xii. Assignment Operators
xiii. Miscellaneous Operators
e. Flow-Control Statements
i. if
ii. switch
iii. while
iv. for
v. foreach
vi. try...catch
vii. declare
viii. exit and return
ix. goto
f. Including Code
g. Embedding PHP in Web Pages
i. Standard (XML) Style
ii. SGML Style
iii. Echoing Content Directly
h. What’s Next
5. 3. Functions
a. Calling a Function
b. Defining a Function
c. Variable Scope
i. Global Variables
ii. Static Variables
d. Function Parameters
i. Passing Parameters by Value
ii. Passing Parameters by Reference
iii. Default Parameters
iv. Variable Parameters
v. Missing Parameters
vi. Type Hinting
e. Return Values
f. Variable Functions
g. Anonymous Functions
h. What’s Next
6. 4. Strings
a. Quoting String Constants
i. Variable Interpolation
ii. Single-Quoted Strings
iii. Double-Quoted Strings
iv. Here Documents
b. Printing Strings
i. echo
ii. print()
iii. printf()
iv. print_r() and var_dump()
c. Accessing Individual Characters
d. Cleaning Strings
i. Removing Whitespace
ii. Changing Case
e. Encoding and Escaping
i. HTML
ii. URLs
iii. SQL
iv. C-String Encoding
f. Comparing Strings
i. Exact Comparisons
ii. Approximate Equality
g. Manipulating and Searching Strings
i. Substrings
ii. Miscellaneous String Functions
iii. Decomposing a String
iv. String-Searching Functions
h. Regular Expressions
i. The Basics
ii. Character Classes
iii. Alternatives
iv. Repeating Sequences
v. Subpatterns
vi. Delimiters
vii. Match Behavior
viii. Character Classes
ix. Anchors
x. Quantifiers and Greed
xi. Noncapturing Groups
xii. Backreferences
xiii. Trailing Options
xiv. Inline Options
xv. Lookahead and Lookbehind
xvi. Cut
xvii. Conditional Expressions
xviii. Functions
xix. Differences from Perl Regular Expressions
i. What’s Next
7. 5. Arrays
a. Indexed Versus Associative Arrays
b. Identifying Elements of an Array
c. Storing Data in Arrays
i. Appending Values to an Array
ii. Assigning a Range of Values
iii. Getting the Size of an Array
iv. Padding an Array
d. Multidimensional Arrays
e. Extracting Multiple Values
i. Slicing an Array
ii. Splitting an Array into Chunks
iii. Keys and Values
iv. Checking Whether an Element Exists
v. Removing and Inserting Elements in an Array
f. Converting Between Arrays and Variables
i. Creating Variables from an Array
ii. Creating an Array from Variables
g. Traversing Arrays
i. The foreach Construct
ii. The Iterator Functions
iii. Using a for Loop
iv. Calling a Function for Each Array Element
v. Reducing an Array
vi. Searching for Values
h. Sorting
i. Sorting One Array at a Time
ii. Natural-Order Sorting
iii. Sorting Multiple Arrays at Once
iv. Reversing Arrays
v. Randomizing Order
i. Acting on Entire Arrays
i. Calculating the Sum of an Array
ii. Merging Two Arrays
iii. Calculating the Difference Between Two Arrays
iv. Filtering Elements from an Array
j. Using Arrays to Implement Data Types
i. Sets
ii. Stacks
k. Implementing the Iterator Interface
l. What’s Next
8. 6. Objects
a. Objects
b. Terminology
c. Creating an Object
d. Accessing Properties and Methods
e. Declaring a Class
i. Declaring Methods
ii. Declaring Properties
iii. Declaring Constants
iv. Inheritance
v. Interfaces
vi. Traits
vii. Abstract Methods
viii. Constructors
ix. Destructors
f. Anonymous Classes
g. Introspection
i. Examining Classes
ii. Examining an Object
iii. Sample Introspection Program
h. Serialization
i. What’s Next
9. 7. Dates and Times
a. What’s Next
10. 8. Web Techniques
a. HTTP Basics
b. Variables
c. Server Information
d. Processing Forms
i. Methods
ii. Parameters
iii. Self-Processing Pages
iv. Sticky Forms
v. Multivalued Parameters
vi. Sticky Multivalued Parameters
vii. File Uploads
viii. Form Validation
e. Setting Response Headers
i. Different Content Types
ii. Redirections
iii. Expiration
iv. Authentication
f. Maintaining State
i. Cookies
ii. Sessions
iii. Combining Cookies and Sessions
g. SSL
h. What’s Next
11. 9. Databases
a. Using PHP to Access a Database
b. Relational Databases and SQL
i. PHP Data Objects
c. MySQLi Object Interface
i. Retrieving Data for Display
d. SQLite
e. Direct File-Level Manipulation
f. MongoDB
i. Retrieving Data
ii. Inserting More Complex Data
g. What’s Next
12. 10. Graphics
a. Embedding an Image in a Page
b. Basic Graphics Concepts
c. Creating and Drawing Images
i. The Structure of a Graphics Program
ii. Changing the Output Format
iii. Testing for Supported Image Formats
iv. Reading an Existing File
v. Basic Drawing Functions
d. Images with Text
i. Fonts
ii. TrueType Fonts
e. Dynamically Generated Buttons
i. Caching the Dynamically Generated Buttons
ii. A Faster Cache
f. Scaling Images
g. Color Handling
i. Using the Alpha Channel
ii. Identifying Colors
iii. True Color Indexes
iv. Text Representation of an Image
h. What’s Next
13. 11. PDF
a. PDF Extensions
b. Documents and Pages
i. A Simple Example
ii. Initializing the Document
iii. Outputting Basic Text Cells
c. Text
i. Coordinates
ii. Text Attributes
iii. Page Headers, Footers, and Class Extension
iv. Images and Links
v. Tables and Data
d. What’s Next
14. 12. XML
a. Lightning Guide to XML
b. Generating XML
c. Parsing XML
i. Element Handlers
ii. Character Data Handler
iii. Processing Instructions
iv. Entity Handlers
v. Default Handler
vi. Options
vii. Using the Parser
viii. Errors
ix. Methods as Handlers
x. Sample Parsing Application
d. Parsing XML with the DOM
e. Parsing XML with SimpleXML
f. Transforming XML with XSLT
g. What’s Next
15. 13. JSON
a. Using JSON
b. Serializing PHP Objects
i. Options
c. What’s Next
16. 14. Security
a. Safeguards
i. Filtering Input
ii. Escaping Output Data
b. Security Vulnerabilities
i. Cross-Site Scripting
ii. SQL Injection
iii. Filename Vulnerabilities
iv. Session Fixation
v. File Upload Traps
vi. Unauthorized File Access
vii. PHP Code Issues
viii. Shell Command Weaknesses
ix. Data Encryption Concerns
c. Further Resources
d. Security Recap
e. What’s Next
17. 15. Application Techniques
a. Code Libraries
b. Templating Systems
c. Handling Output
i. Output Buffering
ii. Output Compression
d. Performance Tuning
i. Benchmarking
ii. Profiling
iii. Optimizing Execution Time
iv. Optimizing Memory Requirements
v. Reverse Proxies and Replication
e. What’s Next
18. 16. Web Services
a. REST Clients
i. Responses
ii. Retrieving Resources
iii. Updating Resources
iv. Creating Resources
v. Deleting Resources
b. XML-RPC
i. Servers
ii. Clients
c. What’s Next
19. 17. Debugging PHP
a. The Development Environment
b. The Staging Environment
c. The Production Environment
d. php.ini Settings
e. Error Handling
i. Error Reporting
ii. Exceptions
iii. Error Suppression
iv. Triggering Errors
v. Defining Error Handlers
f. Manual Debugging
g. Error Logs
h. IDE Debugging
i. Additional Debugging Techniques
j. What’s Next
20. 18. PHP on Disparate Platforms
a. Writing Portable Code for Windows and Unix
i. Determining the Platform
ii. Handling Paths Across Platforms
iii. Navigating the Server Environment
iv. Sending Mail
v. End-of-Line Handling
vi. End-of-File Handling
vii. Using External Commands
viii. Accessing Platform-Specific Extensions
b. Interfacing with COM
i. Background
ii. PHP Functions
iii. API Specifications
21. Function Reference
a. PHP Functions by Category
i. Arrays
ii. Classes and Objects
iii. Data Filtering
iv. Date and Time
v. Directories
vi. Errors and Logging
vii. Filesystem
viii. Functions
ix. Mail
x. Math
xi. Miscellaneous Functions
xii. Network
xiii. Output Buffering
xiv. PHP Language Tokenizer
xv. PHP Options/Info
xvi. Program Execution
xvii. Session Handling
xviii. Streams
xix. Strings
xx. URLs
xxi. Variables
xxii. Zlib
b. Alphabetical Listing of PHP Functions
22. Index
Praise for the 4th Edition of Programming PHP
PHP 7 has rejuvenated the PHP ecosystem, providing a powerful mix of world-
class performance and highly anticipated features. If you’re after the book that
would help you unlock this potential, look no further than the new edition of
Programming PHP!
—Zeev Suraski, Cocreator of PHP
By selecting Programming PHP you have taken that first step not only into PHP
and its basics but into the future of website and web application development.
With a firm understanding of the PHP programming language, and the tools
available to you, the only limitations will be your imagination and your
willingness to continue to grow and immerse yourself in the community.
—Michael Stowe, Author, Speaker, and Technologist
Covers all the details you’d expect in a programming language book and gets into
more advanced topics that seasoned veterans would find interesting.
—James Thoms, Senior Developer at ClearDev
Programming PHP
FOURTH EDITION
Creating Dynamic Web Pages
Kevin Tatroe and Peter MacIntyre
Programming PHP
by Kevin Tatroe and Peter MacIntyre
Copyright © 2020 Kevin Tatroe and Peter MacIntyre. 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://oreilly.com). For more
information, contact our corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Acquisitions Editor: Jennifer Pollock
Development Editor: Angela Rufino
Production Editor: Christopher Faucher
Copyeditor: Rachel Monaghan
Proofreader: Tom Sullivan
Indexer: Potomac Indexing, LLC
Interior Designer: David Futato
Cover Designer: Karen Montgomery
Illustrator: Rebecca Demarest
March 2002: First Edition
April 2006: Second Edition
February 2013: Third Edition
March 2020: Fourth Edition
Revision History for the Fourth Edition
2020-03-12: First Release
See http://oreilly.com/catalog/errata.csp?isbn=9781492054139 for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Programming
PHP, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc.
The views expressed in this work are those of the authors, and do not represent the
publisher’s views. While the publisher and the authors have used good faith efforts to
ensure that the information and instructions contained in this work are accurate, the
publisher and the authors 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-492-05413-9
[LSI]
Dedication
To Jenn
—KT
I would like to dedicate my portions of this book to my still wonderful wife,
Dawn Etta Riley. I love you!
—PBM
Foreword
It’s hard to believe that nearly 20 years ago I picked up my first PHP book. I had an
interest in programming, extending beyond Netscape Composer and static HTML. I
knew PHP would enable me to create dynamic, smarter websites—and to store and
fetch data to create interactive web applications.
What I didn’t know was the journey that unlocking these new capabilities with PHP
would take me on, or how PHP would evolve 20 years later to become the
programming language powering roughly 80% of the web, and backed by one of the
nicest, friendliest, and most engaging communities.
A journey of a thousand miles begins with a single step. By selecting Programming
PHP by Peter MacIntyre and Kevin Tatroe, you have taken that first step not only into
PHP and its basics, but also into the future of website and web application
development. With the available tools and a firm understanding of the PHP
programming language, the only limitation will be your imagination and your
willingness to continue to grow and immerse yourself in the community. The journey is
yours, the possibilities endless, and the future for you to define.
As you get ready to begin this journey, I would like to share a couple tidbits of advice.
First, take each chapter and put it into practice, try different things, and don’t be afraid
of breaking something or failing. While Programming PHP will establish a strong
foundation, it’s up to you to explore the language and find new and creative ways to
pull together all of these components.
My second piece of advice: be an active part of the PHP community. Take advantage of
online communities, user groups, and PHP conferences as you are able. As you try new
things, share them with the community for their feedback and advice.
Not only are you sure to find a community of support—a group of some of the nicest
people, who want you to succeed and are more than happy to take their time to help you
through your journey—but you’ll also establish a baseline of continuous learning,
helping you grasp the core skills of PHP more quickly and keeping you up to date on
new programming theories, technologies, tools, and changes. Not to mention, you’ll
encounter an onslaught of terrible puns (including from yours truly).
With that, I would like to be among the first to welcome you and to wish you the very
best on your journey—a journey that couldn’t start off better than with this book!
Michael Stowe, author, speaker, and technologist
San Francisco, California, Winter 2020
Preface
Now more than ever, the web is a major vehicle for corporate and personal
communications. Websites carry satellite images of Earth in its entirety; search for life
in outer space; house personal photo albums, business shopping carts, and product lists;
and so much more! Many of those websites are driven by PHP, an open source scripting
language primarily designed for generating HTMLcontent.
Since its inception in 1994, PHP has swept the web and continues its phenomenal
growth today. The millions of websites powered by PHP are testament to its popularity
and ease of use. Everyday people can learn PHP and build powerful dynamic websites
with it.
The core PHP language (version 7+) features powerful string- and array-handling
facilities, as well as greatly improved support for object-oriented programming. With
the use of standard and optional extension modules, a PHP application can interact with
a database such as MySQLor Oracle, draw graphs, create PDF files, and parse XML
files. You can run PHP on Windows, which lets you control other Windows
applications (such as Word and Excel with COM) or interact with databases using
ODBC.
This book is a guide to the PHP language. When you finish it (we won’t tell you how it
ends!), you will know how the PHP language works, how to use the many powerful
extensions that come standard with PHP, and how to design and build your own PHP
web applications.
Audience
PHP is a melting pot of cultures. Web designers appreciate its accessibility and
convenience, while programmers appreciate its flexibility, power, diversity, and speed.
Both cultures need a clear and accurate reference to the language. If you are a (web)
programmer, then this book is for you. We show the big picture of the PHP language,
and then discuss the details without wasting your time. The many examples clarify the
textual explanations; the practical programming advice and many style tips will help
you become not just a PHP programmer, but a good PHP programmer.
If you’re a web designer, you will appreciate the clear and useful guides to specific
technologies, such as JSON, XML, sessions, PDF generation, and graphics. And you’ll
be able to quickly get the information you need from the language chapters, which
explain basic programming concepts in simple terms.
This edition has been fully revised to cover the latest features of PHP version 7.4.
Assumptions This Book Makes
This book assumes you have a working knowledge of HTML. If you don’t know
HTML, you should gain some experience with simple web pages before you try to
tackle PHP. For more information on HTML, we recommend HTML & XHTML: The
Definitive Guide by Chuck Musciano and Bill Kennedy (O’Reilly).
Contents of This Book
We’ve arranged the material in this book so that you can either read it from start to
finish or jump around to hit just the topics that interest you. The book is divided into 18
chapters and 1 appendix, as follows:
Chapter 1, Introduction to PHP
Talks about the history of PHP and gives a lightning-fast overview of what is
possible with PHP programs.
Chapter 2, Language Basics
Is a concise guide to PHP program elements such as identifiers, data types,
operators, and flow-control statements.
Chapter 3, Functions
Discusses user-defined functions, including scope, variable-length parameter lists,
and variable and anonymous functions.
Chapter 4, Strings
Covers the functions you’ll use when building, dissecting, searching, and modifying
strings in your PHP code.
Chapter 5, Arrays
Details the notation and functions for constructing, processing, and sorting arrays in
your PHP code.
Chapter 6, Objects
Covers PHP’s updated object-oriented features. In this chapter, you’ll learn about
classes, objects, inheritance, and introspection.
Chapter 7, Dates and Times
Discusses date and time manipulations like time zones and date math.
Chapter 8, Web Techniques
Talks about techniques most PHP programmers eventually want to use, including
processing web form data, maintaining state, and dealing with SSL.
Chapter 9, Databases
Discusses PHP’s modules and functions for working with databases, using MySQL
database as examples. Also, SQLite and PDO database interface are covered.
NoSQLconcepts are also covered here.
Chapter 10, Graphics
Demonstrates how to create and modify image files in a variety of formats from
within PHP.
Chapter 11, PDF
Explains how to create dynamic PDF files from a PHP application.
Chapter 12, XML
Introduces PHP’s extensions for generating and parsing XMLdata.
Chapter 13, JSON
Covers JavaScript Object Notation (JSON), a standardized data-interchange format
designed to be extremely lightweight and human-readable.
Chapter 14, Security
Provides valuable advice and guidance for programmers creating secure scripts.
You’ll learn programming best practices to help you avoid mistakes that can lead to
disaster.
Chapter 15, Application Techniques
Talks about coding techniques like implementing code libraries, dealing with output
in unique ways, and error handling.
Chapter 16, Web Services
Describes techniques for dealing with external communication via REST tools and
cloud connections.
Chapter 17, Debugging PHP
Discusses techniques for debugging PHP code and for writing debuggable PHP
code.
Chapter 18, PHP on Disparate Platforms
Discusses the tricks and traps of the Windows port of PHP. It also discusses some
of the features unique to Windows, such as COM.
Appendix
Serves as a handy quick reference to all core functions in PHP.
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
elements such as variable or function names, databases, data types, environment
variables, statements, and keywords.
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
determined by context.
NOTE
This icon signifies a tip, suggestion, general note, warning, or caution.
O’Reilly Online Learning
Discovering Diverse Content Through
Random Scribd Documents
Every day witnessed the death of large numbers by cold and
starvation. Those who survived were more like walking skeletons
than human beings. They were covered with vermin, and loathsome
to behold. Some were so badly frozen that their flesh fell from their
bones. Many remained disabled for life.
"Oh Religion! what crimes are perpetrated in thy name!" When
Mormons speak of the hand-cart company, they shudder and grow
pale. All this suffering was the result of an attempt, on the part of
the leaders of the church, to save a still larger sum from the
emigration fund. It was a speculative experiment, which was never
repeated. These people bought their carts with their own money;
but on their arrival in Salt Lake, the carts were claimed by Brigham,
in behalf of the church, and were afterwards sold from the tithing-
office at five dollars each.
FOOTNOTES:
[143:A] Persons who are known to possess property, are called
upon to pay for seats in the temple. A lady residing in one of the
northern settlements, was cajoled into paying £50 for that
purpose. The good lady, upon arriving in Utah, found that the
famous temple, in which she had purchased a seat, was scarcely
above its foundations.
[147:A] Jour. of Dis., Vol. I. p. 340.
[148:A] Jour. of Dis. Vol. I. p. 202.
CHAPTER IX.
BRIGHAM AS PROPHET, SEER, AND REVELATOR.
Brigham's Position as Head of the Church.—Mormon
Theology.—Brigham's Theology, or Utah Mormonism.—
Adam as God.—Brigham Young as God.—Human
Sacrifice.—Introduction of Polygamy.—Polygamy no
part of the original Mormon Religion.—The Revelation,
or Celestial Marriage.—The Ceremony of Sealing.—
Consequences and Incidents of the Doctrine.—Incest.
—Summary of the Mormon Religion.
Not only is Brigham Young the temporal head of the church, its
chief business agent, and the sole custodian of its funds, but he is
the spiritual head, the established fountain, in whom is gathered
from on high all spiritual blessings, and from whom they are
expected to flow through the various officers of the priesthood, and
thus be distributed to the faithful among the masses. Standing in
this capacity between the people and the Supreme Being, he is at
once Prophet, Seer, and Revelator. As Prophet and Seer, he sees and
foretells to the people what is to befall them, as the result of certain
courses of action. As Revelator, he reveals and translates, to the
comprehension of the people, the hidden will of God concerning
them.
An acknowledgment of this relationship of Brigham with the
Divine Being is made a test of fellowship; as in the case of the
Morrisites, who, although they admitted his right to preside over the
church as its temporal head, denied him the attributes of prophet
and revelator. Hence they were cut off from the church.
Acting in this capacity, he not only prescribes a course of conduct
for his followers, but promulgates, from time to time, doctrines, to
be received, believed, and advocated. Thus the theology or creed of
the church changes, from time to time, to suit the changing
opinions, the whims and caprices, or the passions and lusts, of its
head and leader. What is here said, therefore, of the Mormon
religion, must be understood in reference to the received doctrines
and tenets of the church in former years,—many of which still
remain, but incorporated with new dogmas, and any part or all of
which are liable at any time to be changed, modified, or entirely
overthrown.
Mormon Theology.
There are many Gods, and they are of both sexes. But to us
there is but one God,—the Father of mankind, and the Creator of the
earth.
Men and women are literally the sons and daughters of God,—
our spirits having been literally begotten by God, in the heavenly
world, and having been afterwards sent to the earth, and invested
with these tabernacles.
God is in the form of man. He has a body, composed of spiritual
matter. There is no difference between matter and spirit, except in
quality. Spirit is matter refined.
God is omnipotent, but not personally omnipresent. He is
everywhere present by his Holy Spirit. His personality is generally
expressed by the phrase, "He has body, parts, and passions." He
resides in the centre of the universe, near the planet Kolob. This
planet revolves on its axis once in a thousand of our years, and one
revolution of Kolob is a day to the Almighty.
Jesus Christ was the Son of God, literally begotten by the Father,
and had the Spirit of God in the body of a man. After his
resurrection, he had a body of flesh and bones only, typical of man's
resurrected body. He differs in nothing from the Father, except in
age and authority,—the Father having the seniority, and
consequently the right to preside.
The Holy Spirit is a subtle fluid, like electricity. It is the subtlest
form of matter, and pervades all space. By its agency all miracles, so
called, are performed. Miracles are simply the effects of the
operation of natural laws. But they are laws of a higher character
than those with which we are acquainted. This Holy Spirit is
communicated by the laying-on of hands by one of the properly
authorized priesthood, and the recipient is then enabled to perform
wonderful things, according to his gift,—some having the gift of
prophecy, some of healing, some of speaking in unknown tongues,
etc.
There are three heavens,—the telestial, the terrestrial, and the
celestial.
The telestial and terrestrial heavens are to be occupied by the
various classes of persons who have neither obeyed nor rejected the
gospel. The telestial is typified by the stars,—the terrestrial, by the
moon.
The celestial, or highest heaven, has for its type the sun, and is
reserved for those who received the testimony of Jesus, and
believed on His name, and were baptized by one having authority
from Him, and who afterwards lived a holy life.
The earth, as purified and refined, after the second coming of
Christ, is to be the final habitation of those entitled to the glories of
the celestial kingdom. Jerusalem is to be rebuilt, and Zion, or the
New Jerusalem, is to be built in Jackson County, Missouri, whence
the saints were expelled in 1833.
There is a fourth class of persons, not entitled to either of these
heavens. They are those who sin against the Holy Ghost; that is,
those who apostatize after receiving the Holy Spirit. These go into
everlasting punishment, to remain with the devil and his angels.
The gospel, which people are called upon to obey, in order to
gain a place in the celestial kingdom, is,—First, They must believe in
Jesus Christ as the Son of God, and in His authorized priesthood.
Secondly, They must repent of their sins; Thirdly, They must be
baptized by immersion for the remission of their sins; and, Fourthly,
They must receive the laying-on of hands for the gift of the Holy
Ghost.
God, having become nearly lost to man, revived His work, by
revealing himself to Joseph Smith, and conferring upon him the keys
of the everlasting Priesthood,—thus making him the mediator of a
New Dispensation, which is immediately to precede the second
coming of Christ. All those who recognize the divine authority of
Smith, and are baptized by one having authority, are the chosen
people of God, who are to introduce the Millennium, and to reign
with Christ, on earth, a thousand years.
Previous to the year 1852, it was also an orthodox principle of
the Mormon religion, that a man should have but one wife, to whom
he should be true and faithful.
Those who have any curiosity to pursue the subject further, will
find these views and doctrines fully explained and illustrated in the
religious writings of the Mormons,—of which the following are some
of the principal: Book of Mormon; Book of Doctrine and Covenants;
Works of Orson Pratt; Key to Theology, by P. P. Pratt; The Only Way
to be Saved, etc., by L. Snow; Pearl of Great Price; Voice of Warning,
by P. P. Pratt; Catechism for Children, by John Jaques; Deseret
News, 14 vols.; Journal of Discourses, 6 vols.; Latter-Day Saints'
Millennial Star, London, 26 volumes.
Brigham's Theology; or Utah Mormonism.
The doctrines taught and practised by the present head of the
Mormon Church differ so much from the previously established
tenets of the church, that they require a separate consideration.
One of the most important innovations upon the established
doctrines of the church, is in relation to the Godhead. In April, 1852,
Brigham put forth the startling doctrine that Adam is God, and to be
recognized and honored as such! This announcement created some
consternation among the Mormon theologians, and some of them
had the courage to oppose it. The following is the "Revelator's" own
exposition of this doctrine:—
"When the Virgin Mary conceived the child Jesus, the
Father had begotten him in his own likeness. He was not
begotten by the Holy Ghost. And who is the Father? He is
the first of the human family; and when he took a
tabernacle, it was begotten by his Father in heaven, after
the same manner as the tabernacle of Cain, Abel, and the
rest of the sons and daughters of Adam and Eve. . . . It is
true that the earth was organized by three distinct
characters, namely: Elohim, Yahovah, and Michael,
[Adam;] these three forming a quorum, as in all heavenly
bodies, and in organized element perfectly represented in
the Deity, as Father, Son, and Holy Ghost.
"When our Father Adam came into the garden of Eden,
he came with a celestial body, and brought Eve, one of his
wives, with him. He helped to make and organize this
world. He is Michael, the Archangel, the Ancient of Days.
He is our Father and our God, and the only God with
whom we have to do. . . . Jesus, our elder brother, was
begotten in the flesh by the same character that was in
the garden of Eden, and who is our Father in heaven."
[157:A]
It is manifest that Young is not so much at home in theology as
when engaged in financial schemes and money speculations. So
disgusting and blasphemous are these ideas, and so unacceptable
were they, even to Mormons, who were not prepared to see the
basis of their religion thus rudely overthrown, that Brigham finally
felt compelled to caution the Elders not to preach the new doctrine
concerning Deity, until the people should be better prepared to
receive them.
Mahomet is the great exemplar and prototype whom Brigham
Young aims to imitate, and doubtless he took from the Koran his
ideas about the deity of Adam. Thus in chapter two of the Koran, we
have the following:—
"And when we said unto the angels, 'worship Adam,'
they all worshipped him, except Eblis, [Lucifer,] who
refused."
From the following affidavit of John Stiles, father of Judge Stiles,
formerly one of the United States Judges in Utah, a man of much
probity of character, and well known in Salt Lake City as "Father
Stiles," it appears that the blasphemous pretensions of Brigham
Young do not stop with Adam, but that, among the brethren, he has
encouraged a doctrine, which he dare not put in print;—no less than
to arrogate to himself the attributes of Deity.
"Territory of Utah,
Great Salt Lake City.
ss.
"In the spring of 1856," John Stiles says, "I resided in
the 11th Ward of Great Salt Lake City, in the Territory of
Utah. I was appointed by the quorum to which I then
belonged, as a Missionary High-Priest for the said Ward.
My duty was to look after the morals of the people of the
Ward, and especially to see that there was no false
doctrine taught there. I subsequently found that there
were not only immoralities, but also false doctrines among
some of the people, as I supposed at the time. Many
people believed and taught the doctrine, that Brigham
Young was all the God that we were amenable to. I found
by opposing that doctrine, that I gave offence to the
authorities of the Ward, and was consequently called to
answer for my opposition before the Bishop of the Ward,
although he had no jurisdiction over me. As a High-Priest I
was amenable to a higher authority, but not to him.
"In a public assembly he wished me to state my views
on the question, whether if Brigham Young was not God,
who was? I told him I would do so. I rose and stated that
my idea of the being of God was expressed in a passage
of Scripture, and I need only repeat the passage to
explain the idea. The passage was: 'To us there is but one
God, the Father, of whom are all things, and we in Him,
and one Lord Jesus Christ, by whom are all things, and we
by Him.' I subsequently, in explanation, cited this passage
of Scripture: 'This is life eternal, that we might know thee,
the only living and true God, and Jesus Christ whom thou
hast sent.' I then sat down, and the Bishop rose and said:
'Brethren, we perceive that Father Stiles runs round
Brigham.' I replied, 'Yes; I do not mention Brigham Young
on the same day with God, as of the same Godhead.' His
(the Bishop's) First Counsellor, then moved that Father
Stiles be cut off from the church. This was seconded by
the Second Counsellor. This was proposed to the assembly
as a question by the Bishop, and I was cut off accordingly.
I subsequently discovered that by my opposition and
explanation, I gave offence to the authorities of the
Mormon Church, and was cut off from the church and
dismissed from the place of Missionary High-Priest of that
Ward. I have never been restored as Missionary High-
Priest.
(Signed,) John Stiles.
"Sworn to and subscribed before me at Great Salt Lake
City, this April 26th, 1864.
"John Titus,
Ch. Justice of Utah."
Another doctrine of a startling character, promulgated by one of
Young's counsellors and endorsed by him, is that of human sacrifice
for the remission of sins.
It was first announced by Jedediah M. Grant, Second Counsellor
to the President, in the following language:—
"Brethren and sisters, we want you to repent and
forsake your sins. And you who have committed sins that
cannot be forgiven through baptism, let your blood be
shed, and let the smoke ascend, that the incense thereof
may come up before God as an atonement for your sins,
and that the sinners in Zion may be afraid."[159:A]
Again:—
"We have been trying long enough with this people,
and I go in for letting the sword of the Almighty be
unsheathed, not only in word, but in deed."[159:B]
In accordance with such bloody teaching, it is said that an altar
of sacrifice was actually built by Grant, in the temple block, upon
which these human sacrifices were to be made. On the 21st of
September, 1856, Grant said:—
"I say there are men and women here that I would
advise to go to the President immediately, and ask him to
appoint a committee to attend to their case; and then let
a place be selected, and let that committee shed their
blood."[159:C]
This horrible proposal to immolate upon the altar of sacrifice the
erring saints, was fully endorsed by Brigham Young as follows:—
"There are sins that men commit for which they cannot
receive forgiveness in this world, or in that which is to
come; and if they had their eyes open to see their
condition, they would be perfectly willing to have their
blood spilt upon the ground, that the smoke thereof might
ascend to Heaven as an offering for their sins, and the
smoking incense would atone for their sins; whereas, if
such is not the case, they will stick to them, and remain
upon them in the spirit-world.
"I know, when you hear my brethren telling about
cutting people off from the earth, that you consider it is
strong doctrine. It is to save them, not to destroy them. I
will say further, I have had men come to me, and offer
their lives to atone for their sins. It is true that the blood
of the Son of God was shed for sins, through the fall, and
those committed by man, yet men can commit sins which
it can never remit. As it was in ancient days, so it is in our
day; and though the principles are taught publicly from
this stand, still the people do not understand them; yet
the Law is precisely the same. There are sins that can be
atoned for by an offering upon the altar, as in ancient
days, and there are sins that the blood of a lamb, of a
calf, or of turtle-doves cannot remit, but they must be
atoned for by the blood of the man. That is the reason
why men talk to you as they do from this stand. They
understand the doctrine, and throw out a few words about
it."[160:A]
But the greatest change of all in the Mormon religion, made by
Brigham Young, was the introduction and establishment of
polygamy.
This was no part of the Mormon system of religion as originally
established. On the contrary, it was expressly repudiated by all the
Mormon writers and speakers, previous to 1852, and in Europe for
some years afterward.
The Mormon religion was founded by Joseph Smith and his
coadjutors, and the principles and doctrines of the religion were, in
the first instance, such as they established. The Book of Mormon is
the historical foundation, corresponding with the Old Testament of
the Christian Bible. Afterward, a volume of revelations to Smith and
others was collected and published, called the Book of Doctrine and
Covenants. This corresponds to the Christian's New Testament. It
may be safely asserted, therefore, that previous to the innovations
of Young, the Mormon religion was embodied in these two volumes.
Their authority in the church is universal and unquestioned.
Let us examine these volumes, and see whether they teach or
countenance polygamy.
The Book of Mormon nowhere contains a word in favor of it. On
the contrary all of its principal characters were monogamists. Such
was Lehi, the patriarch of Mormon history. Such also were Ishmael
and Nephi.[161:A] That the people of Zarahemla were monogamists,
is evident from what is said concerning them on page 146.
But we are not left to inference as to the testimony of this
volume concerning this practice. On page 119 we have the
following:—
"Behold the Lamanites, your brethren, whom ye hate
because of their filthiness and the cursings which hath
come upon their skins, are more righteous than you; for
they have not forgotten the commandment of the Lord,
which was given unto our fathers, that they should have,
save it were one wife; and concubines they should have
none; and there should not be whoredoms committed
among them. And now, this commandment they observe
to keep; wherefore, because of this observance, in
keeping this commandment, the Lord God will not destroy
them, but will be merciful unto them; and one day they
shall become a blessed people."[161:B]
Again:—
"And it came to pass that Riplakish did not do that
which was right in the sight of the Lord, for he did have
many wives and concubines, and did lay that upon men's
shoulders which was grievous to be borne; yea, he did tax
them with heavy taxes; and with the taxes he did build
many spacious buildings."[162:A]
And again:—
"And he [Noah] did not walk in the ways of his father.
[Zeniff.] For behold, he did not keep the commandments
of God, but he did walk after the desires of his own heart.
And he had many wives and concubines. And he did cause
his people to commit sin, and to do that which was
abominable in the sight of the Lord. Yea, and they did
commit whoredoms and all manner of wickedness. And he
laid a tax of one fifth part of all they possessed." . . . "All
this did he take to support himself, and his wives and his
concubines; and also his priests, and their wives and their
concubines; thus he had changed the affairs of the
kingdom."[162:B]
"And it came to pass that he placed his heart upon his
riches, and he spent his time in riotous living, with his
wives and his concubines; and so did also his priests
spend their time with harlots."[162:C]
As if to place this matter beyond any question, we have the
following still more explicit testimony, on pages 115 and 118:—
"And now it came to pass that the people of Nephi,
under the reign of the second king, began to grow hard in
their hearts and indulge themselves somewhat in wicked
practices, such as like unto David of old, desiring many
wives and concubines, and also Solomon his son." . . .
"The word of God burdens me because of your grosser
crimes. For behold, thus saith the Lord, this people begin
to wax in iniquity; they understand not the Scriptures; for
they seek to excuse themselves in committing
whoredoms, because of the things which were written
concerning David, and Solomon his son. Behold David and
Solomon truly had many wives and concubines, which
thing was abominable before me, saith the Lord:
wherefore, thus saith the Lord, I have led this people forth
out of the land of Jerusalem, by the power of mine arm,
that I might raise up unto me a righteous branch from the
fruit of the loins of Joseph. Wherefore, I the Lord God, will
not suffer that this people shall do like unto them of old.
Wherefore, my brethren, hear me, and hearken to the
word of the Lord; for there shall not any man among you
have, save it be one wife; and concubines he shall have
none; for I, the Lord God, delighteth in the chastity of
women. And whoredoms are an abomination before me;
thus saith the Lord of Hosts."[163:A]
Here it is stated as coming from God himself, that the polygamy
and concubinage of David and Solomon were abominable before the
Lord. And yet we every day hear David and Solomon, as well as
Abraham, Jacob, and others, cited by those practising polygamy, as
their illustrious prototypes, whose example is worthy of all imitation.
Orson Pratt, the ablest writer on Mormon theology, is compelled
to admit that the Book of Mormon is opposed to polygamy. He says:
—
"Do you believe that the Book of Mormon is a divine
revelation? We do. Does that book teach the doctrine of
plurality of wives? It does not. Does the Lord in that book
forbid the plurality doctrine? He forbid the ancient
Nephites to have any more than one wife."[163:B]
Elder Pratt then endeavors to blunt the force of this testimony in
the following manner:—
"Why were the ancient Nephites restricted to the one-
wife system? Because, first, the number of males and
females among them, at the time the command was
given, was about equal. Secondly, there was no probability
that judgments, wars, or any other calamities which were
to befall their nation, would produce a disproportionate
number of males and females. Thirdly, this small remnant
of the tribe of Joseph, were, at that time, about equally
righteous; and one was about as capable of raising up a
family in righteousness as another. And, lastly, the Lord
himself informs them, in the same connection with the
quotation which I have just made, that if He would have
them practise differently from what He had previously
taught them, it must be by His command."[164:A]
Thus, in the attempt to weaken the force of the evidence
furnished by the Book of Mormon against polygamy, Pratt
acknowledges, in the most explicit manner, the validity of the
argument against it, founded upon the equality in the numbers of
each sex. Two of the four reasons why the Nephites were to retain
monogamy, relate to the equality in the numbers of the sexes. But
there is a substantial equality in the numbers of the sexes, not only
in the United States, but in Utah Territory. (See U. S. Census.)
Let us now turn to the Book of Doctrine and Covenants, and see
if we can find in that volume any authority for polygamy. The
following passages will determine the question:—
"Thou shalt love thy wife with all thy heart, and shalt
cleave unto her, and none else; and he that looketh upon
a woman to lust after her, shall deny the faith, and shall
not have the spirit; and if he repents not he shall be cast
out."[164:B]
Again. In 1845, the year after Smith's death, an Appendix was
authoritatively added to the Book of Doctrine and Covenants,
containing the following, which is extracted from the section entitled
"Marriage":—
"2. Marriage should be celebrated with prayer and
thanksgiving; and at the solemnization, the persons to be
married standing together," etc., "he [the person
officiating] shall say, calling each by their names, 'you
both mutually agree to be each other's companion,
husband and wife, observing the legal rights belonging to
this condition; that is, keeping yourselves wholly for each
other, and from all others, during your lives.' And when
they have answered 'yes,' he shall pronounce them
'husband and wife,' in the name of the Lord Jesus Christ
and by virtue of the laws of the country, and authority
vested in him. . . .
"4. . . . Inasmuch as this church of Christ has been
reproached with the crime of fornication and polygamy;
we declare that we believe that one man should have one
wife; and one woman but one husband, except in case of
death, when either is at liberty to marry again."[165:A]
Can anything be more explicit than this? Polygamy is not only
expressly repudiated by the church, but is classed by the side of
fornication as a crime.
Thus we find that polygamy is contrary to both books of the
Mormon Bible. That it is, in fact, strongly condemned in those
volumes.
It is, therefore, no part of the Mormon religion, as given to the
world by Joseph Smith.
But polygamy is practised in Utah. Whence did it arise, and upon
what foundation does it rest?
Like slavery, and all other great social evils, it had its origin,
doubtless, in an abuse of the passions of man.
It was first publicly announced and recommended in Utah
Territory on the 29th of August, 1852, by Orson Pratt and Brigham
Young, at a politico-religious meeting, held in Great Salt Lake City.
On that occasion, President Young said:—
"You heard Brother Pratt state, this morning, that a
Revelation would be read this afternoon, which was given
previous to Joseph's death. It contains a doctrine a small
portion of the world is opposed to; but I can deliver a
prophecy upon it. Though that doctrine has not been
preached by the Elders, this people have believed in it for
years.
"The original copy of this Revelation was burnt up.
William Clayton was the man who wrote it from the mouth
of the Prophet. In the mean time it was in Bishop
Whitney's possession. He wished the privilege to copy it,
which Brother Joseph granted. Sister Emma (wife of
Joseph Smith) burnt the original. The reason I mention
this is, because that the people who did know of the
Revelation, suppose it was not now in existence.
"The Revelation will be read to you. The principle
spoken upon by Brother Pratt this morning, we believe in.
. . . "Many others are of the same mind. They are not
ignorant of what we are doing in our social capacity. They
have cried out proclaim it; but it would not do a few years
ago; everything must come in its time, as there is a time
to all things. I am now ready to proclaim it.
"This Revelation has been in my possession many
years; and who has known it? None but those who should
know it. I keep a patent lock on my desk, and there does
not anything leak out that should not."[166:A]
The Revelation, so called, which was read at the close of this
sermon, purports to have been given to Joseph Smith, July 12, 1843.
It is very lengthy, consisting of twenty-five sections or paragraphs. It
is published in full, in Burton's "City of the Saints," and in various
other publications. The following synopsis exhibits all that is
essential of this extraordinary Revelation.
THE REVELATION.
Section 1. "Verily, thus saith the Lord unto you, my servant
Joseph, that inasmuch as you have inquired of my hand to know and
understand wherein I, the Lord, justified my servants Abraham,
Isaac, and Jacob, as also Moses, David, and Solomon, my servants,
as touching the principle and doctrine of their having many wives
and concubines: Behold, and lo, I am the Lord thy God, and will
answer thee as touching this matter." [The balance of this section is
prefatory, declaring that a new law and everlasting covenant is about
to be revealed, and that he who abides not that covenant shall be
damned.]
Sec. 2. All covenants, contracts, vows, etc., not made and sealed
by the Holy Spirit of promise, of him who is anointed (Joseph Smith)
both as well for time and for all eternity, are of no efficacy or force
after the resurrection.
Sec. 3 represents the necessity of having everything sanctioned
by the Almighty.
Secs. 4 and 5. Persons married for life only, or for time and
eternity, but not by the proper authority, not bound to each other
after this life.
Sec. 6 provides that if a man marry a wife by the law of God, and
by the new and everlasting covenant, and if they abide in the
covenant, and do not shed innocent blood, then the covenant shall
be binding throughout time and eternity, "and they shall pass by the
angels, and the gods which are set there, to their exaltation and
glory in all things."
Sec. 7 declares that such shall be gods in the eternal world.
Sec. 8 states that none can receive such exaltation except those
who receive and abide the law of God.
Sec. 9. "Verily, verily I say unto you, if a man marry a wife
according to my word, and they are sealed by the Holy Spirit of
promise according to mine appointment, and he or she shall commit
any sin or transgression of the new and everlasting covenant
whatever, and all manner of blasphemies, and if they commit no
murder wherein they shed innocent blood, yet they shall come forth
in the first resurrection, and enter into their exaltation, but they shall
be destroyed in the flesh, and shall be delivered unto the buffetings
of Satan unto the day of redemption, saith the Lord God."
Sec. 10 explains that shedding innocent blood, and assenting
unto the death of Christ, is the blasphemy against the Holy Ghost,
which shall not be forgiven in the world nor out of the world.
Secs. 11 and 12 refer to Abraham as the father of the faithful,
and him to whom the promises were made. "This promise is yours
also, because ye are of Abraham, and the promise was made unto
Abraham." "Go ye, therefore, and do the works of Abraham; and
enter ye into my law, and ye shall be saved."
Sec. 13 intimates that Sarah acted in accordance with the
command of God in giving Hagar to Abraham.
Sec. 14 refers to the concubines which Abraham received, and
says, "they bare him children, and it was accounted unto him for
righteousness." The latter part of the section is as follows: "David
also received many wives and concubines, as also Solomon, and
Moses my servant; and also many others of my servants, from the
beginning of creation until this time; and in nothing did they sin save
in those things which they received not of me."
Sec. 15. "David's wives and concubines were given unto him, of
me, by the hand of Nathan, my servant, and others of the prophets
who had the keys of this power; and in none of these things did he
sin against me, save in the case of Uriah and his wife; and therefore
he hath fallen from his exaltation, and received his portion; and he
shall not inherit them out of the world; for I gave them unto another,
saith the Lord."
Sec. 16 prescribes certain regulations concerning those who
commit adultery, and provides that in case the husband commits
adultery, and the wife is innocent, and the fact is revealed by God to
Joseph, the wife shall be given by Smith to one who has not
committed adultery, "but hath been faithful, for he shall be made
ruler over many."
Sec. 17. "And verily, verily I say unto you, that whatsoever you
seal on earth shall be sealed in heaven; and whatsoever you bind on
earth in my name and by my word, saith the Lord, it shall be
eternally bound in the heavens; and whosesoever sins you remit on
earth shall be remitted eternally in the heavens; and whosesoever
sins ye retain on earth shall be retained in heaven."
Sec. 18. "And again, verily I say, whomsoever you bless I will
bless, and whomsoever you curse I will curse, saith the Lord; for I,
the Lord, am thy God."
Sec. 19. "And again, verily I say unto you, my servant Joseph,
that whatsoever you give on earth, and to whomsoever you give any
one on earth, by my word, and according to my law, it shall be
visited with blessings, and not cursings, and with my power, saith
the Lord, and shall be without condemnation, on earth and in
heaven." Then follows a declaration to the effect that Smith has
found favor with God, and that he will forgive his sins, etc.
Sec. 20 commands Emma Smith "that she stay herself, and
partake not of that which I commanded you to offer unto her; for I
did it, saith the Lord, to prove you all," etc., and continues as
follows: "And let mine handmaid, Emma Smith, receive all those that
have been given unto my servant Joseph, and who are virtuous and
pure before me; and those who are not pure, and have said they are
pure, shall be destroyed, saith the Lord God; for I am the Lord thy
God," etc.
Sec. 21 commands Emma Smith, wife of Joseph, to abide and
cleave unto Joseph and none else, under penalty of destruction. She
is also exhorted to forgive Joseph his trespasses.
Sec. 22 forbids Joseph putting his property out of his hands.
Sec. 23 touches upon the law of the priesthood, and says of any
one who is called of God, as was Aaron, "if he do anything in my
name, and according to my law, and by my word, he will not commit
sin, and I will justify him." Joseph is to be justified, etc.
The last two sections are as follows:—
Sec. 24. "And again, as pertaining to the law of the priesthood: if
any man espouse a virgin, and desire to espouse another, and the
first gives her consent; and if he espouse the second, and they are
virgins, and have vowed to no other man, then he is justified; he
cannot commit adultery, for they are given unto him; for he cannot
commit adultery with that that belongeth unto them, and to none
else; and if he have ten virgins given unto him by this law, he cannot
commit adultery, for they belong to him, and they are given unto
him; therefore is he justified. But if one, or either of the ten virgins,
after she is espoused, shall be with another man, she has committed
adultery, and shall be destroyed; for they are given unto him to
multiply and replenish the earth, according to my commandment,
and to fulfil the promise which was given by my Father before the
foundation of the world, and for their exaltation in the eternal
worlds, that they may bear the souls of men; for herein is the work
of my Father continued, that he may be glorified."
Sec. 25. "And again, verily, verily I say unto you, if any man have
a wife who holds the keys of this power, and he teaches unto her the
law of my priesthood as pertaining to these things, then shall she
believe, and administer unto him, or she shall be destroyed, saith
the Lord your God; for I will destroy her; for I will magnify my name
upon all those who receive and abide in my law. Therefore it shall be
lawful in me, if she receive not this law, for him to receive all things
whatsoever I, the Lord his God, will give unto him, because she did
not believe and administer unto him, according to my word; and she
then becomes the transgressor, and he is exempt from the law of
Sarah, who administered unto Abraham according to the law, when I
commanded Abraham to take Hagar to wife. And now, as pertaining
to this law: Verily, verily I say unto you, I will reveal more unto you
hereafter; therefore let this suffice, for the present. Behold, I am
Alpha and Omega. Amen."
Such is the foundation upon which is built the superstructure of
Utah polygamy. And the system itself, what is it in its theory and
practical application? The mode of its institution has been shown. Its
ceremonials, and many facts illustrative of its tendency and effects,
will be given; and it is for our readers to determine how much it is
better than promiscuous intercourse, and to discover, if they can, its
redeeming features, as distinguished from such a state of society.
No man who has a wife already, has any right to make
propositions of marriage to a lady, until he has consulted the
President of the whole church, and through him obtained a
revelation from God upon the subject. If the revelation be favorable,
he must next obtain the approbation of the parents, and thirdly, he
is to consult the lady herself.
It is also necessary that the first wife be consulted. If she refuses
her consent, however, the lover husband may take an appeal to the
President; and unless the wife can give to the President satisfactory
reasons why her consent is withheld, the husband may proceed to
introduce another wife into the family, against her will. The plan is,
either to divorce the first wife, and damn her eternally, or to torment
her daily, until, with a broken heart and a crushed spirit, she goes to
the altar, and there gives another to her husband. Thus the
semblance of her approbation is obtained.
The exquisite cruelty of this abominable practice will appear most
vividly from the marriage ceremony.
"When the day set apart for the solemnization of the
marriage ceremony has arrived, the bridegroom and the
wife, and also the bride, together with their relations, and
such other guests as may be invited, assemble at the
place which they have appointed. The scribe then
proceeds to take the names, ages, native towns, counties,
States, and countries of the parties to be married, which
he carefully enters on record. The President, who is the
Prophet, Seer, and Revelator over the whole church,
throughout the whole world, and who alone holds the
keys of authority in this solemn ordinance, calls upon the
bridegroom and his wife, and the bride, to arise, which
they do, fronting the President. The wife stands on the left
hand of her husband, while the bride stands on her left.
The President then puts this question to the wife: 'Are you
willing to give this woman to your husband, to be his
lawful and wedded wife, for time and all eternity? If you
are, you will manifest it by placing her right hand within
the right hand of your husband.' The right hands of the
bridegroom and the bride being thus joined, the wife
takes her husband by the left arm, as if in the attitude of
walking. The President then proceeds to ask the following
questions of the man: 'Do you, brother, (calling him by
name) take sister (calling the bride by name) by the right
hand, to receive her unto yourself, to be your lawful and
wedded wife, and you to be her lawful and wedded
husband, for time and for all eternity, with a covenant and
promise on your part, that you fulfil all the laws, rites, and
ordinances pertaining to this holy matrimony, in the new
and everlasting covenant,—doing this in the presence of
God, angels, and these witnesses, of your own free will
and choice?' The bridegroom answers, 'Yes.' The President
then puts the question to the bride: 'Do you, sister,
(calling her by name) take brother (calling him by name)
by the right hand, and give yourself to him to be his lawful
and wedded wife, for time and for all eternity, with a
covenant and promise, on your part, that you will fulfil all
the laws, rites, and ordinances pertaining to this holy
matrimony, in the new and everlasting covenant,—doing
this in the presence of God, angels, and these witnesses,
of your own free will and choice?' The bride answers,
'Yes.' The President then says: 'In the name of the Lord
Jesus Christ, and by the authority of the Holy Priesthood, I
pronounce you legally and lawfully husband and wife, for
time and all eternity; and I seal upon you the blessings of
the holy resurrection, with power to come forth in the
morning of the first resurrection, clothed with glory,
immortality, and eternal lives; and I seal upon you the
blessings of thrones, and dominions, and principalities,
and powers, and exaltations; together with the blessings
of Abraham, Isaac, and Jacob; and say unto you, be
fruitful and multiply, and replenish the earth, that you may
have joy and rejoicing in your posterity, in the day of the
Lord Jesus. All these blessings, together with all other
blessings, pertaining to the new and everlasting covenant,
I seal upon your heads, and enjoin your faithfulness unto
the end, by the authority of the Holy Priesthood, in the
name of the Father, and of the Son, and of the Holy
Ghost. Amen.'"
The scribe then enters the marriage on the records, and the
parties retire. The wedding is then celebrated with a feast at the
husband's house, and a "Mormon dance." The new wife is assigned
a room,—if indeed the happy husband's domicil contains two rooms,
—and her experience in "plurality" begins.
In well-regulated Mormon families, the first wife stands at the
head of domestic concerns. She carries the keys of the storehouse,
makes the purchases for the family, and deals them out to the plural
wives, in much the same manner as other housekeepers do to their
cooks. The husband's will is law, and from it there is no appeal,
except in extreme cases, when the Bishop may be consulted.
If a husband has lost his wife by death, before he had the
opportunity of attending to this holy ordinance, and securing her as
his lawful wife for eternity, then it is the duty of the second wife,
first, to be sealed or married to the husband, for and in the name of
the deceased wife, for all eternity; and, secondly, to be married for
time and eternity herself, to the same man. Thus, by this holy
ordinance, both the dead and the living wife will be his in the eternal
worlds. But if, previous to marriage for eternity, a woman lose her
husband by death, and marry a second, and if her first husband was
a good man, then it is the duty of the second husband to be married
to her for eternity, not for himself, but in the name of her deceased
husband, while he himself can only be married to her for time; and
he is obliged to enter into a covenant to deliver her up, and all her
children, to her deceased husband, in the morning of the first
resurrection.
Thus, by these refinements, a religious veil, captivating to the
fancy, is thrown over the institution to hide its deformity. The same
distinctions are carried through all the various relations of life; hence
in case a widow is married to a widower, three ceremonies are
necessary, in order fully to establish the eternal relations of all the
parties.
Incest is the practical result of some of the branches of this new-
fangled system of sealing and marriage. It has already been shown,
by the report of the Committee on Territories in the United States
Senate, and the Message of Gov. Harding, that a mother and her
daughters (by a former husband) all live together, as wives of the
same husband.[173:A]
A still more revolting relation is sometimes maintained. It is
called "heirship," and is plainly enough sanctioned by Young, as
follows:—
"The text is, the right of heirship. I will, however, make
an addition to the scripture, before I proceed further with
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
textbookfull.com

More Related Content

PDF
Programming PHP 4th Edition Peter Macintyre 2024 scribd download
PDF
Get Programming PHP 4th Edition Peter Macintyre free all chapters
PDF
Learning Java An Introduction to Real World Programming with Java Marc Loy
PDF
Python-for-DevOps-Learn-Ruthlessly-Effective-Automation-by-Noah-Gift_-Kennedy...
PDF
Php my sql programing - brochure
PDF
Learning Java An Introduction to Real World Programming with Java Marc Loy
PDF
(Ebook) High Performance Python by Micha Gorelick, Ian Ozsvald
PDF
Web Development with Node and Express Leveraging the JavaScript Stack 2nd Edi...
Programming PHP 4th Edition Peter Macintyre 2024 scribd download
Get Programming PHP 4th Edition Peter Macintyre free all chapters
Learning Java An Introduction to Real World Programming with Java Marc Loy
Python-for-DevOps-Learn-Ruthlessly-Effective-Automation-by-Noah-Gift_-Kennedy...
Php my sql programing - brochure
Learning Java An Introduction to Real World Programming with Java Marc Loy
(Ebook) High Performance Python by Micha Gorelick, Ian Ozsvald
Web Development with Node and Express Leveraging the JavaScript Stack 2nd Edi...

Similar to Programming PHP 4th Edition Peter Macintyre (20)

PDF
(Ebook) Programming TypeScript: Making Your JavaScript Applications Scale by ...
PDF
High Performance Python 2nd Edition Micha Gorelick Ian Ozsvald
PDF
High Performance Python 2nd Edition Micha Gorelick
PDF
(Ebook) Python for DevOps: Learn Ruthlessly Effective Automation by Noah Gift...
PDF
Complete Download Web Development with Node and Express 2nd Edition Ethan Bro...
PDF
Mongodb The Definitive Guide 3rd Edition 3rd Edition Kristina Chodorow Eoin B...
PDF
Infrastructure as Code 2nd Edition Early Access Kief Morris
PDF
Web Development with Node and Express 2nd Edition Ethan Brown
PDF
Data Management at Scale Best Practices for Enterprise Architecture 1st Editi...
PDF
Infrastructure as Code 2nd Edition Early Access Kief Morris all chapter inst...
PDF
Instant download Data Management at Scale Best Practices for Enterprise Archi...
PDF
Opentext exstream dialogue online training | Opentext exstream dialogue train...
PDF
Data Management at Scale Best Practices for Enterprise Architecture 1st Editi...
PDF
Data Management at Scale Best Practices for Enterprise Architecture 1st Editi...
PDF
JavaScript The Definitive Guide 7th Edition David Flanagan
DOC
Qtp Summary
PDF
(Ebook) Data Science with Python by coll.
PDF
(Ebook) Data Management at Scale: Best Practices for Enterprise Architecture ...
DOCX
Causal Arguments--2014Why do students drop out of schoolWha.docx
PDF
J query fundamentals
(Ebook) Programming TypeScript: Making Your JavaScript Applications Scale by ...
High Performance Python 2nd Edition Micha Gorelick Ian Ozsvald
High Performance Python 2nd Edition Micha Gorelick
(Ebook) Python for DevOps: Learn Ruthlessly Effective Automation by Noah Gift...
Complete Download Web Development with Node and Express 2nd Edition Ethan Bro...
Mongodb The Definitive Guide 3rd Edition 3rd Edition Kristina Chodorow Eoin B...
Infrastructure as Code 2nd Edition Early Access Kief Morris
Web Development with Node and Express 2nd Edition Ethan Brown
Data Management at Scale Best Practices for Enterprise Architecture 1st Editi...
Infrastructure as Code 2nd Edition Early Access Kief Morris all chapter inst...
Instant download Data Management at Scale Best Practices for Enterprise Archi...
Opentext exstream dialogue online training | Opentext exstream dialogue train...
Data Management at Scale Best Practices for Enterprise Architecture 1st Editi...
Data Management at Scale Best Practices for Enterprise Architecture 1st Editi...
JavaScript The Definitive Guide 7th Edition David Flanagan
Qtp Summary
(Ebook) Data Science with Python by coll.
(Ebook) Data Management at Scale: Best Practices for Enterprise Architecture ...
Causal Arguments--2014Why do students drop out of schoolWha.docx
J query fundamentals
Ad

Recently uploaded (20)

PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
RMMM.pdf make it easy to upload and study
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Computing-Curriculum for Schools in Ghana
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
VCE English Exam - Section C Student Revision Booklet
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
O5-L3 Freight Transport Ops (International) V1.pdf
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
102 student loan defaulters named and shamed – Is someone you know on the list?
human mycosis Human fungal infections are called human mycosis..pptx
Anesthesia in Laparoscopic Surgery in India
Basic Mud Logging Guide for educational purpose
Microbial diseases, their pathogenesis and prophylaxis
RMMM.pdf make it easy to upload and study
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Computing-Curriculum for Schools in Ghana
Abdominal Access Techniques with Prof. Dr. R K Mishra
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Insiders guide to clinical Medicine.pdf
TR - Agricultural Crops Production NC III.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
VCE English Exam - Section C Student Revision Booklet
Ad

Programming PHP 4th Edition Peter Macintyre

  • 1. Programming PHP 4th Edition Peter Macintyre download https://textbookfull.com/product/programming-php-4th-edition- peter-macintyre/ Download more ebook from https://textbookfull.com
  • 2. We believe these products will be a great fit for you. Click the link to download now, or visit textbookfull.com to discover even more! Learn Java for Android Development: Migrating Java SE Programming Skills to Mobile Development 4th Edition Peter Späth https://textbookfull.com/product/learn-java-for-android- development-migrating-java-se-programming-skills-to-mobile- development-4th-edition-peter-spath/ Programming Language Concepts Peter Sestoft https://textbookfull.com/product/programming-language-concepts- peter-sestoft/ Lumen Programming Guide Writing PHP Microservices REST and Web Service APIs 1st Edition Paul Redmond (Auth.) https://textbookfull.com/product/lumen-programming-guide-writing- php-microservices-rest-and-web-service-apis-1st-edition-paul- redmond-auth/ Programming WCF Services 4th Edition Juval Löwy https://textbookfull.com/product/programming-wcf-services-4th- edition-juval-lowy/
  • 3. Programming in Lua 4th Edition Roberto Ierusalimschy https://textbookfull.com/product/programming-in-lua-4th-edition- roberto-ierusalimschy/ Pro Functional PHP Programming Application Development Strategies for Performance Optimization, Concurrency, Testability, and Code Brevity Aley https://textbookfull.com/product/pro-functional-php-programming- application-development-strategies-for-performance-optimization- concurrency-testability-and-code-brevity-aley/ Pro Functional PHP Programming: Application Development Strategies for Performance Optimization, Concurrency, Testability, and Code Brevity Rob Aley https://textbookfull.com/product/pro-functional-php-programming- application-development-strategies-for-performance-optimization- concurrency-testability-and-code-brevity-rob-aley/ Computer Programming and Utilization, 4e 4th Edition E. Balagurusamy https://textbookfull.com/product/computer-programming-and- utilization-4e-4th-edition-e-balagurusamy/ Advanced Apex Programming in Salesforce 4th Edition Dan Appleman https://textbookfull.com/product/advanced-apex-programming-in- salesforce-4th-edition-dan-appleman/
  • 5. 1. Foreword 2. Preface a. Audience b. Assumptions This Book Makes c. Contents of This Book d. Conventions Used in This Book e. O’Reilly Online Learning f. How to Contact Us g. Acknowledgments i. Kevin Tatroe ii. Peter MacIntyre 3. 1. Introduction to PHP a. What Does PHP Do? b. A Brief History of PHP i. The Evolution of PHP ii. The Widespread Use of PHP c. Installing PHP d. A Walk Through PHP i. Configuration Page ii. Forms iii. Databases iv. Graphics e. What’s Next 4. 2. Language Basics a. Lexical Structure
  • 6. i. Case Sensitivity ii. Statements and Semicolons iii. Whitespace and Line Breaks iv. Comments v. Literals vi. Identifiers vii. Keywords b. Data Types i. Integers ii. Floating-Point Numbers iii. Strings iv. Booleans v. Arrays vi. Objects vii. Resources viii. Callbacks ix. NULL c. Variables i. Variable Variables ii. Variable References iii. Variable Scope iv. Garbage Collection d. Expressions and Operators i. Number of Operands ii. Operator Precedence iii. Operator Associativity iv. Implicit Casting
  • 7. v. Arithmetic Operators vi. String Concatenation Operator vii. Auto-Increment and Auto-Decrement Operators viii. Comparison Operators ix. Bitwise Operators x. Logical Operators xi. Casting Operators xii. Assignment Operators xiii. Miscellaneous Operators e. Flow-Control Statements i. if ii. switch iii. while iv. for v. foreach vi. try...catch vii. declare viii. exit and return ix. goto f. Including Code g. Embedding PHP in Web Pages i. Standard (XML) Style ii. SGML Style iii. Echoing Content Directly h. What’s Next 5. 3. Functions a. Calling a Function
  • 8. b. Defining a Function c. Variable Scope i. Global Variables ii. Static Variables d. Function Parameters i. Passing Parameters by Value ii. Passing Parameters by Reference iii. Default Parameters iv. Variable Parameters v. Missing Parameters vi. Type Hinting e. Return Values f. Variable Functions g. Anonymous Functions h. What’s Next 6. 4. Strings a. Quoting String Constants i. Variable Interpolation ii. Single-Quoted Strings iii. Double-Quoted Strings iv. Here Documents b. Printing Strings i. echo ii. print() iii. printf() iv. print_r() and var_dump()
  • 9. c. Accessing Individual Characters d. Cleaning Strings i. Removing Whitespace ii. Changing Case e. Encoding and Escaping i. HTML ii. URLs iii. SQL iv. C-String Encoding f. Comparing Strings i. Exact Comparisons ii. Approximate Equality g. Manipulating and Searching Strings i. Substrings ii. Miscellaneous String Functions iii. Decomposing a String iv. String-Searching Functions h. Regular Expressions i. The Basics ii. Character Classes iii. Alternatives iv. Repeating Sequences v. Subpatterns vi. Delimiters vii. Match Behavior viii. Character Classes ix. Anchors
  • 10. x. Quantifiers and Greed xi. Noncapturing Groups xii. Backreferences xiii. Trailing Options xiv. Inline Options xv. Lookahead and Lookbehind xvi. Cut xvii. Conditional Expressions xviii. Functions xix. Differences from Perl Regular Expressions i. What’s Next 7. 5. Arrays a. Indexed Versus Associative Arrays b. Identifying Elements of an Array c. Storing Data in Arrays i. Appending Values to an Array ii. Assigning a Range of Values iii. Getting the Size of an Array iv. Padding an Array d. Multidimensional Arrays e. Extracting Multiple Values i. Slicing an Array ii. Splitting an Array into Chunks iii. Keys and Values iv. Checking Whether an Element Exists v. Removing and Inserting Elements in an Array f. Converting Between Arrays and Variables
  • 11. i. Creating Variables from an Array ii. Creating an Array from Variables g. Traversing Arrays i. The foreach Construct ii. The Iterator Functions iii. Using a for Loop iv. Calling a Function for Each Array Element v. Reducing an Array vi. Searching for Values h. Sorting i. Sorting One Array at a Time ii. Natural-Order Sorting iii. Sorting Multiple Arrays at Once iv. Reversing Arrays v. Randomizing Order i. Acting on Entire Arrays i. Calculating the Sum of an Array ii. Merging Two Arrays iii. Calculating the Difference Between Two Arrays iv. Filtering Elements from an Array j. Using Arrays to Implement Data Types i. Sets ii. Stacks k. Implementing the Iterator Interface l. What’s Next 8. 6. Objects
  • 12. a. Objects b. Terminology c. Creating an Object d. Accessing Properties and Methods e. Declaring a Class i. Declaring Methods ii. Declaring Properties iii. Declaring Constants iv. Inheritance v. Interfaces vi. Traits vii. Abstract Methods viii. Constructors ix. Destructors f. Anonymous Classes g. Introspection i. Examining Classes ii. Examining an Object iii. Sample Introspection Program h. Serialization i. What’s Next 9. 7. Dates and Times a. What’s Next 10. 8. Web Techniques a. HTTP Basics b. Variables c. Server Information
  • 13. d. Processing Forms i. Methods ii. Parameters iii. Self-Processing Pages iv. Sticky Forms v. Multivalued Parameters vi. Sticky Multivalued Parameters vii. File Uploads viii. Form Validation e. Setting Response Headers i. Different Content Types ii. Redirections iii. Expiration iv. Authentication f. Maintaining State i. Cookies ii. Sessions iii. Combining Cookies and Sessions g. SSL h. What’s Next 11. 9. Databases a. Using PHP to Access a Database b. Relational Databases and SQL i. PHP Data Objects c. MySQLi Object Interface i. Retrieving Data for Display
  • 14. d. SQLite e. Direct File-Level Manipulation f. MongoDB i. Retrieving Data ii. Inserting More Complex Data g. What’s Next 12. 10. Graphics a. Embedding an Image in a Page b. Basic Graphics Concepts c. Creating and Drawing Images i. The Structure of a Graphics Program ii. Changing the Output Format iii. Testing for Supported Image Formats iv. Reading an Existing File v. Basic Drawing Functions d. Images with Text i. Fonts ii. TrueType Fonts e. Dynamically Generated Buttons i. Caching the Dynamically Generated Buttons ii. A Faster Cache f. Scaling Images g. Color Handling i. Using the Alpha Channel ii. Identifying Colors iii. True Color Indexes
  • 15. iv. Text Representation of an Image h. What’s Next 13. 11. PDF a. PDF Extensions b. Documents and Pages i. A Simple Example ii. Initializing the Document iii. Outputting Basic Text Cells c. Text i. Coordinates ii. Text Attributes iii. Page Headers, Footers, and Class Extension iv. Images and Links v. Tables and Data d. What’s Next 14. 12. XML a. Lightning Guide to XML b. Generating XML c. Parsing XML i. Element Handlers ii. Character Data Handler iii. Processing Instructions iv. Entity Handlers v. Default Handler vi. Options vii. Using the Parser
  • 16. viii. Errors ix. Methods as Handlers x. Sample Parsing Application d. Parsing XML with the DOM e. Parsing XML with SimpleXML f. Transforming XML with XSLT g. What’s Next 15. 13. JSON a. Using JSON b. Serializing PHP Objects i. Options c. What’s Next 16. 14. Security a. Safeguards i. Filtering Input ii. Escaping Output Data b. Security Vulnerabilities i. Cross-Site Scripting ii. SQL Injection iii. Filename Vulnerabilities iv. Session Fixation v. File Upload Traps vi. Unauthorized File Access vii. PHP Code Issues viii. Shell Command Weaknesses ix. Data Encryption Concerns
  • 17. c. Further Resources d. Security Recap e. What’s Next 17. 15. Application Techniques a. Code Libraries b. Templating Systems c. Handling Output i. Output Buffering ii. Output Compression d. Performance Tuning i. Benchmarking ii. Profiling iii. Optimizing Execution Time iv. Optimizing Memory Requirements v. Reverse Proxies and Replication e. What’s Next 18. 16. Web Services a. REST Clients i. Responses ii. Retrieving Resources iii. Updating Resources iv. Creating Resources v. Deleting Resources b. XML-RPC i. Servers ii. Clients
  • 18. c. What’s Next 19. 17. Debugging PHP a. The Development Environment b. The Staging Environment c. The Production Environment d. php.ini Settings e. Error Handling i. Error Reporting ii. Exceptions iii. Error Suppression iv. Triggering Errors v. Defining Error Handlers f. Manual Debugging g. Error Logs h. IDE Debugging i. Additional Debugging Techniques j. What’s Next 20. 18. PHP on Disparate Platforms a. Writing Portable Code for Windows and Unix i. Determining the Platform ii. Handling Paths Across Platforms iii. Navigating the Server Environment iv. Sending Mail v. End-of-Line Handling vi. End-of-File Handling vii. Using External Commands viii. Accessing Platform-Specific Extensions
  • 19. b. Interfacing with COM i. Background ii. PHP Functions iii. API Specifications 21. Function Reference a. PHP Functions by Category i. Arrays ii. Classes and Objects iii. Data Filtering iv. Date and Time v. Directories vi. Errors and Logging vii. Filesystem viii. Functions ix. Mail x. Math xi. Miscellaneous Functions xii. Network xiii. Output Buffering xiv. PHP Language Tokenizer xv. PHP Options/Info xvi. Program Execution xvii. Session Handling xviii. Streams xix. Strings xx. URLs xxi. Variables
  • 20. xxii. Zlib b. Alphabetical Listing of PHP Functions 22. Index
  • 21. Praise for the 4th Edition of Programming PHP PHP 7 has rejuvenated the PHP ecosystem, providing a powerful mix of world- class performance and highly anticipated features. If you’re after the book that would help you unlock this potential, look no further than the new edition of Programming PHP! —Zeev Suraski, Cocreator of PHP By selecting Programming PHP you have taken that first step not only into PHP and its basics but into the future of website and web application development. With a firm understanding of the PHP programming language, and the tools available to you, the only limitations will be your imagination and your willingness to continue to grow and immerse yourself in the community. —Michael Stowe, Author, Speaker, and Technologist Covers all the details you’d expect in a programming language book and gets into more advanced topics that seasoned veterans would find interesting. —James Thoms, Senior Developer at ClearDev
  • 22. Programming PHP FOURTH EDITION Creating Dynamic Web Pages Kevin Tatroe and Peter MacIntyre
  • 23. Programming PHP by Kevin Tatroe and Peter MacIntyre Copyright © 2020 Kevin Tatroe and Peter MacIntyre. 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://oreilly.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Acquisitions Editor: Jennifer Pollock Development Editor: Angela Rufino Production Editor: Christopher Faucher Copyeditor: Rachel Monaghan Proofreader: Tom Sullivan Indexer: Potomac Indexing, LLC Interior Designer: David Futato Cover Designer: Karen Montgomery Illustrator: Rebecca Demarest March 2002: First Edition April 2006: Second Edition February 2013: Third Edition March 2020: Fourth Edition
  • 24. Revision History for the Fourth Edition 2020-03-12: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781492054139 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. Programming PHP, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. The views expressed in this work are those of the authors, and do not represent the publisher’s views. While the publisher and the authors have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the authors 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-492-05413-9 [LSI]
  • 25. Dedication To Jenn —KT I would like to dedicate my portions of this book to my still wonderful wife, Dawn Etta Riley. I love you! —PBM
  • 26. Foreword It’s hard to believe that nearly 20 years ago I picked up my first PHP book. I had an interest in programming, extending beyond Netscape Composer and static HTML. I knew PHP would enable me to create dynamic, smarter websites—and to store and fetch data to create interactive web applications. What I didn’t know was the journey that unlocking these new capabilities with PHP would take me on, or how PHP would evolve 20 years later to become the programming language powering roughly 80% of the web, and backed by one of the nicest, friendliest, and most engaging communities. A journey of a thousand miles begins with a single step. By selecting Programming PHP by Peter MacIntyre and Kevin Tatroe, you have taken that first step not only into PHP and its basics, but also into the future of website and web application development. With the available tools and a firm understanding of the PHP programming language, the only limitation will be your imagination and your willingness to continue to grow and immerse yourself in the community. The journey is yours, the possibilities endless, and the future for you to define. As you get ready to begin this journey, I would like to share a couple tidbits of advice. First, take each chapter and put it into practice, try different things, and don’t be afraid of breaking something or failing. While Programming PHP will establish a strong foundation, it’s up to you to explore the language and find new and creative ways to pull together all of these components. My second piece of advice: be an active part of the PHP community. Take advantage of online communities, user groups, and PHP conferences as you are able. As you try new things, share them with the community for their feedback and advice. Not only are you sure to find a community of support—a group of some of the nicest people, who want you to succeed and are more than happy to take their time to help you through your journey—but you’ll also establish a baseline of continuous learning, helping you grasp the core skills of PHP more quickly and keeping you up to date on new programming theories, technologies, tools, and changes. Not to mention, you’ll
  • 27. encounter an onslaught of terrible puns (including from yours truly). With that, I would like to be among the first to welcome you and to wish you the very best on your journey—a journey that couldn’t start off better than with this book! Michael Stowe, author, speaker, and technologist San Francisco, California, Winter 2020
  • 28. Preface Now more than ever, the web is a major vehicle for corporate and personal communications. Websites carry satellite images of Earth in its entirety; search for life in outer space; house personal photo albums, business shopping carts, and product lists; and so much more! Many of those websites are driven by PHP, an open source scripting language primarily designed for generating HTMLcontent. Since its inception in 1994, PHP has swept the web and continues its phenomenal growth today. The millions of websites powered by PHP are testament to its popularity and ease of use. Everyday people can learn PHP and build powerful dynamic websites with it. The core PHP language (version 7+) features powerful string- and array-handling facilities, as well as greatly improved support for object-oriented programming. With the use of standard and optional extension modules, a PHP application can interact with a database such as MySQLor Oracle, draw graphs, create PDF files, and parse XML files. You can run PHP on Windows, which lets you control other Windows applications (such as Word and Excel with COM) or interact with databases using ODBC. This book is a guide to the PHP language. When you finish it (we won’t tell you how it ends!), you will know how the PHP language works, how to use the many powerful extensions that come standard with PHP, and how to design and build your own PHP web applications. Audience PHP is a melting pot of cultures. Web designers appreciate its accessibility and convenience, while programmers appreciate its flexibility, power, diversity, and speed. Both cultures need a clear and accurate reference to the language. If you are a (web) programmer, then this book is for you. We show the big picture of the PHP language,
  • 29. and then discuss the details without wasting your time. The many examples clarify the textual explanations; the practical programming advice and many style tips will help you become not just a PHP programmer, but a good PHP programmer. If you’re a web designer, you will appreciate the clear and useful guides to specific technologies, such as JSON, XML, sessions, PDF generation, and graphics. And you’ll be able to quickly get the information you need from the language chapters, which explain basic programming concepts in simple terms. This edition has been fully revised to cover the latest features of PHP version 7.4.
  • 30. Assumptions This Book Makes This book assumes you have a working knowledge of HTML. If you don’t know HTML, you should gain some experience with simple web pages before you try to tackle PHP. For more information on HTML, we recommend HTML & XHTML: The Definitive Guide by Chuck Musciano and Bill Kennedy (O’Reilly). Contents of This Book We’ve arranged the material in this book so that you can either read it from start to finish or jump around to hit just the topics that interest you. The book is divided into 18 chapters and 1 appendix, as follows: Chapter 1, Introduction to PHP Talks about the history of PHP and gives a lightning-fast overview of what is possible with PHP programs. Chapter 2, Language Basics Is a concise guide to PHP program elements such as identifiers, data types, operators, and flow-control statements. Chapter 3, Functions Discusses user-defined functions, including scope, variable-length parameter lists, and variable and anonymous functions. Chapter 4, Strings Covers the functions you’ll use when building, dissecting, searching, and modifying strings in your PHP code. Chapter 5, Arrays Details the notation and functions for constructing, processing, and sorting arrays in your PHP code. Chapter 6, Objects Covers PHP’s updated object-oriented features. In this chapter, you’ll learn about classes, objects, inheritance, and introspection. Chapter 7, Dates and Times
  • 31. Discusses date and time manipulations like time zones and date math. Chapter 8, Web Techniques Talks about techniques most PHP programmers eventually want to use, including processing web form data, maintaining state, and dealing with SSL. Chapter 9, Databases Discusses PHP’s modules and functions for working with databases, using MySQL database as examples. Also, SQLite and PDO database interface are covered. NoSQLconcepts are also covered here. Chapter 10, Graphics Demonstrates how to create and modify image files in a variety of formats from within PHP. Chapter 11, PDF Explains how to create dynamic PDF files from a PHP application. Chapter 12, XML Introduces PHP’s extensions for generating and parsing XMLdata. Chapter 13, JSON Covers JavaScript Object Notation (JSON), a standardized data-interchange format designed to be extremely lightweight and human-readable. Chapter 14, Security Provides valuable advice and guidance for programmers creating secure scripts. You’ll learn programming best practices to help you avoid mistakes that can lead to disaster. Chapter 15, Application Techniques Talks about coding techniques like implementing code libraries, dealing with output in unique ways, and error handling. Chapter 16, Web Services Describes techniques for dealing with external communication via REST tools and cloud connections. Chapter 17, Debugging PHP Discusses techniques for debugging PHP code and for writing debuggable PHP code.
  • 32. Chapter 18, PHP on Disparate Platforms Discusses the tricks and traps of the Windows port of PHP. It also discusses some of the features unique to Windows, such as COM. Appendix Serves as a handy quick reference to all core functions in PHP. 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 elements such as variable or function names, databases, data types, environment variables, statements, and keywords. 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 determined by context. NOTE This icon signifies a tip, suggestion, general note, warning, or caution. O’Reilly Online Learning
  • 33. Discovering Diverse Content Through Random Scribd Documents
  • 34. Every day witnessed the death of large numbers by cold and starvation. Those who survived were more like walking skeletons than human beings. They were covered with vermin, and loathsome to behold. Some were so badly frozen that their flesh fell from their bones. Many remained disabled for life. "Oh Religion! what crimes are perpetrated in thy name!" When Mormons speak of the hand-cart company, they shudder and grow pale. All this suffering was the result of an attempt, on the part of the leaders of the church, to save a still larger sum from the emigration fund. It was a speculative experiment, which was never repeated. These people bought their carts with their own money; but on their arrival in Salt Lake, the carts were claimed by Brigham, in behalf of the church, and were afterwards sold from the tithing- office at five dollars each.
  • 35. FOOTNOTES: [143:A] Persons who are known to possess property, are called upon to pay for seats in the temple. A lady residing in one of the northern settlements, was cajoled into paying £50 for that purpose. The good lady, upon arriving in Utah, found that the famous temple, in which she had purchased a seat, was scarcely above its foundations. [147:A] Jour. of Dis., Vol. I. p. 340. [148:A] Jour. of Dis. Vol. I. p. 202.
  • 36. CHAPTER IX. BRIGHAM AS PROPHET, SEER, AND REVELATOR. Brigham's Position as Head of the Church.—Mormon Theology.—Brigham's Theology, or Utah Mormonism.— Adam as God.—Brigham Young as God.—Human Sacrifice.—Introduction of Polygamy.—Polygamy no part of the original Mormon Religion.—The Revelation, or Celestial Marriage.—The Ceremony of Sealing.— Consequences and Incidents of the Doctrine.—Incest. —Summary of the Mormon Religion. Not only is Brigham Young the temporal head of the church, its chief business agent, and the sole custodian of its funds, but he is the spiritual head, the established fountain, in whom is gathered from on high all spiritual blessings, and from whom they are expected to flow through the various officers of the priesthood, and thus be distributed to the faithful among the masses. Standing in this capacity between the people and the Supreme Being, he is at once Prophet, Seer, and Revelator. As Prophet and Seer, he sees and foretells to the people what is to befall them, as the result of certain courses of action. As Revelator, he reveals and translates, to the comprehension of the people, the hidden will of God concerning them. An acknowledgment of this relationship of Brigham with the Divine Being is made a test of fellowship; as in the case of the Morrisites, who, although they admitted his right to preside over the church as its temporal head, denied him the attributes of prophet and revelator. Hence they were cut off from the church. Acting in this capacity, he not only prescribes a course of conduct for his followers, but promulgates, from time to time, doctrines, to
  • 37. be received, believed, and advocated. Thus the theology or creed of the church changes, from time to time, to suit the changing opinions, the whims and caprices, or the passions and lusts, of its head and leader. What is here said, therefore, of the Mormon religion, must be understood in reference to the received doctrines and tenets of the church in former years,—many of which still remain, but incorporated with new dogmas, and any part or all of which are liable at any time to be changed, modified, or entirely overthrown. Mormon Theology. There are many Gods, and they are of both sexes. But to us there is but one God,—the Father of mankind, and the Creator of the earth. Men and women are literally the sons and daughters of God,— our spirits having been literally begotten by God, in the heavenly world, and having been afterwards sent to the earth, and invested with these tabernacles. God is in the form of man. He has a body, composed of spiritual matter. There is no difference between matter and spirit, except in quality. Spirit is matter refined. God is omnipotent, but not personally omnipresent. He is everywhere present by his Holy Spirit. His personality is generally expressed by the phrase, "He has body, parts, and passions." He resides in the centre of the universe, near the planet Kolob. This planet revolves on its axis once in a thousand of our years, and one revolution of Kolob is a day to the Almighty. Jesus Christ was the Son of God, literally begotten by the Father, and had the Spirit of God in the body of a man. After his resurrection, he had a body of flesh and bones only, typical of man's resurrected body. He differs in nothing from the Father, except in
  • 38. age and authority,—the Father having the seniority, and consequently the right to preside. The Holy Spirit is a subtle fluid, like electricity. It is the subtlest form of matter, and pervades all space. By its agency all miracles, so called, are performed. Miracles are simply the effects of the operation of natural laws. But they are laws of a higher character than those with which we are acquainted. This Holy Spirit is communicated by the laying-on of hands by one of the properly authorized priesthood, and the recipient is then enabled to perform wonderful things, according to his gift,—some having the gift of prophecy, some of healing, some of speaking in unknown tongues, etc. There are three heavens,—the telestial, the terrestrial, and the celestial. The telestial and terrestrial heavens are to be occupied by the various classes of persons who have neither obeyed nor rejected the gospel. The telestial is typified by the stars,—the terrestrial, by the moon. The celestial, or highest heaven, has for its type the sun, and is reserved for those who received the testimony of Jesus, and believed on His name, and were baptized by one having authority from Him, and who afterwards lived a holy life. The earth, as purified and refined, after the second coming of Christ, is to be the final habitation of those entitled to the glories of the celestial kingdom. Jerusalem is to be rebuilt, and Zion, or the New Jerusalem, is to be built in Jackson County, Missouri, whence the saints were expelled in 1833. There is a fourth class of persons, not entitled to either of these heavens. They are those who sin against the Holy Ghost; that is, those who apostatize after receiving the Holy Spirit. These go into everlasting punishment, to remain with the devil and his angels. The gospel, which people are called upon to obey, in order to gain a place in the celestial kingdom, is,—First, They must believe in
  • 39. Jesus Christ as the Son of God, and in His authorized priesthood. Secondly, They must repent of their sins; Thirdly, They must be baptized by immersion for the remission of their sins; and, Fourthly, They must receive the laying-on of hands for the gift of the Holy Ghost. God, having become nearly lost to man, revived His work, by revealing himself to Joseph Smith, and conferring upon him the keys of the everlasting Priesthood,—thus making him the mediator of a New Dispensation, which is immediately to precede the second coming of Christ. All those who recognize the divine authority of Smith, and are baptized by one having authority, are the chosen people of God, who are to introduce the Millennium, and to reign with Christ, on earth, a thousand years. Previous to the year 1852, it was also an orthodox principle of the Mormon religion, that a man should have but one wife, to whom he should be true and faithful. Those who have any curiosity to pursue the subject further, will find these views and doctrines fully explained and illustrated in the religious writings of the Mormons,—of which the following are some of the principal: Book of Mormon; Book of Doctrine and Covenants; Works of Orson Pratt; Key to Theology, by P. P. Pratt; The Only Way to be Saved, etc., by L. Snow; Pearl of Great Price; Voice of Warning, by P. P. Pratt; Catechism for Children, by John Jaques; Deseret News, 14 vols.; Journal of Discourses, 6 vols.; Latter-Day Saints' Millennial Star, London, 26 volumes. Brigham's Theology; or Utah Mormonism. The doctrines taught and practised by the present head of the Mormon Church differ so much from the previously established tenets of the church, that they require a separate consideration. One of the most important innovations upon the established doctrines of the church, is in relation to the Godhead. In April, 1852, Brigham put forth the startling doctrine that Adam is God, and to be
  • 40. recognized and honored as such! This announcement created some consternation among the Mormon theologians, and some of them had the courage to oppose it. The following is the "Revelator's" own exposition of this doctrine:— "When the Virgin Mary conceived the child Jesus, the Father had begotten him in his own likeness. He was not begotten by the Holy Ghost. And who is the Father? He is the first of the human family; and when he took a tabernacle, it was begotten by his Father in heaven, after the same manner as the tabernacle of Cain, Abel, and the rest of the sons and daughters of Adam and Eve. . . . It is true that the earth was organized by three distinct characters, namely: Elohim, Yahovah, and Michael, [Adam;] these three forming a quorum, as in all heavenly bodies, and in organized element perfectly represented in the Deity, as Father, Son, and Holy Ghost. "When our Father Adam came into the garden of Eden, he came with a celestial body, and brought Eve, one of his wives, with him. He helped to make and organize this world. He is Michael, the Archangel, the Ancient of Days. He is our Father and our God, and the only God with whom we have to do. . . . Jesus, our elder brother, was begotten in the flesh by the same character that was in the garden of Eden, and who is our Father in heaven." [157:A] It is manifest that Young is not so much at home in theology as when engaged in financial schemes and money speculations. So disgusting and blasphemous are these ideas, and so unacceptable were they, even to Mormons, who were not prepared to see the basis of their religion thus rudely overthrown, that Brigham finally felt compelled to caution the Elders not to preach the new doctrine concerning Deity, until the people should be better prepared to receive them.
  • 41. Mahomet is the great exemplar and prototype whom Brigham Young aims to imitate, and doubtless he took from the Koran his ideas about the deity of Adam. Thus in chapter two of the Koran, we have the following:— "And when we said unto the angels, 'worship Adam,' they all worshipped him, except Eblis, [Lucifer,] who refused." From the following affidavit of John Stiles, father of Judge Stiles, formerly one of the United States Judges in Utah, a man of much probity of character, and well known in Salt Lake City as "Father Stiles," it appears that the blasphemous pretensions of Brigham Young do not stop with Adam, but that, among the brethren, he has encouraged a doctrine, which he dare not put in print;—no less than to arrogate to himself the attributes of Deity. "Territory of Utah, Great Salt Lake City. ss. "In the spring of 1856," John Stiles says, "I resided in the 11th Ward of Great Salt Lake City, in the Territory of Utah. I was appointed by the quorum to which I then belonged, as a Missionary High-Priest for the said Ward. My duty was to look after the morals of the people of the Ward, and especially to see that there was no false doctrine taught there. I subsequently found that there were not only immoralities, but also false doctrines among some of the people, as I supposed at the time. Many people believed and taught the doctrine, that Brigham Young was all the God that we were amenable to. I found by opposing that doctrine, that I gave offence to the authorities of the Ward, and was consequently called to answer for my opposition before the Bishop of the Ward,
  • 42. although he had no jurisdiction over me. As a High-Priest I was amenable to a higher authority, but not to him. "In a public assembly he wished me to state my views on the question, whether if Brigham Young was not God, who was? I told him I would do so. I rose and stated that my idea of the being of God was expressed in a passage of Scripture, and I need only repeat the passage to explain the idea. The passage was: 'To us there is but one God, the Father, of whom are all things, and we in Him, and one Lord Jesus Christ, by whom are all things, and we by Him.' I subsequently, in explanation, cited this passage of Scripture: 'This is life eternal, that we might know thee, the only living and true God, and Jesus Christ whom thou hast sent.' I then sat down, and the Bishop rose and said: 'Brethren, we perceive that Father Stiles runs round Brigham.' I replied, 'Yes; I do not mention Brigham Young on the same day with God, as of the same Godhead.' His (the Bishop's) First Counsellor, then moved that Father Stiles be cut off from the church. This was seconded by the Second Counsellor. This was proposed to the assembly as a question by the Bishop, and I was cut off accordingly. I subsequently discovered that by my opposition and explanation, I gave offence to the authorities of the Mormon Church, and was cut off from the church and dismissed from the place of Missionary High-Priest of that Ward. I have never been restored as Missionary High- Priest. (Signed,) John Stiles. "Sworn to and subscribed before me at Great Salt Lake City, this April 26th, 1864. "John Titus, Ch. Justice of Utah."
  • 43. Another doctrine of a startling character, promulgated by one of Young's counsellors and endorsed by him, is that of human sacrifice for the remission of sins. It was first announced by Jedediah M. Grant, Second Counsellor to the President, in the following language:— "Brethren and sisters, we want you to repent and forsake your sins. And you who have committed sins that cannot be forgiven through baptism, let your blood be shed, and let the smoke ascend, that the incense thereof may come up before God as an atonement for your sins, and that the sinners in Zion may be afraid."[159:A] Again:— "We have been trying long enough with this people, and I go in for letting the sword of the Almighty be unsheathed, not only in word, but in deed."[159:B] In accordance with such bloody teaching, it is said that an altar of sacrifice was actually built by Grant, in the temple block, upon which these human sacrifices were to be made. On the 21st of September, 1856, Grant said:— "I say there are men and women here that I would advise to go to the President immediately, and ask him to appoint a committee to attend to their case; and then let a place be selected, and let that committee shed their blood."[159:C] This horrible proposal to immolate upon the altar of sacrifice the erring saints, was fully endorsed by Brigham Young as follows:— "There are sins that men commit for which they cannot receive forgiveness in this world, or in that which is to come; and if they had their eyes open to see their
  • 44. condition, they would be perfectly willing to have their blood spilt upon the ground, that the smoke thereof might ascend to Heaven as an offering for their sins, and the smoking incense would atone for their sins; whereas, if such is not the case, they will stick to them, and remain upon them in the spirit-world. "I know, when you hear my brethren telling about cutting people off from the earth, that you consider it is strong doctrine. It is to save them, not to destroy them. I will say further, I have had men come to me, and offer their lives to atone for their sins. It is true that the blood of the Son of God was shed for sins, through the fall, and those committed by man, yet men can commit sins which it can never remit. As it was in ancient days, so it is in our day; and though the principles are taught publicly from this stand, still the people do not understand them; yet the Law is precisely the same. There are sins that can be atoned for by an offering upon the altar, as in ancient days, and there are sins that the blood of a lamb, of a calf, or of turtle-doves cannot remit, but they must be atoned for by the blood of the man. That is the reason why men talk to you as they do from this stand. They understand the doctrine, and throw out a few words about it."[160:A] But the greatest change of all in the Mormon religion, made by Brigham Young, was the introduction and establishment of polygamy. This was no part of the Mormon system of religion as originally established. On the contrary, it was expressly repudiated by all the Mormon writers and speakers, previous to 1852, and in Europe for some years afterward. The Mormon religion was founded by Joseph Smith and his coadjutors, and the principles and doctrines of the religion were, in
  • 45. the first instance, such as they established. The Book of Mormon is the historical foundation, corresponding with the Old Testament of the Christian Bible. Afterward, a volume of revelations to Smith and others was collected and published, called the Book of Doctrine and Covenants. This corresponds to the Christian's New Testament. It may be safely asserted, therefore, that previous to the innovations of Young, the Mormon religion was embodied in these two volumes. Their authority in the church is universal and unquestioned. Let us examine these volumes, and see whether they teach or countenance polygamy. The Book of Mormon nowhere contains a word in favor of it. On the contrary all of its principal characters were monogamists. Such was Lehi, the patriarch of Mormon history. Such also were Ishmael and Nephi.[161:A] That the people of Zarahemla were monogamists, is evident from what is said concerning them on page 146. But we are not left to inference as to the testimony of this volume concerning this practice. On page 119 we have the following:— "Behold the Lamanites, your brethren, whom ye hate because of their filthiness and the cursings which hath come upon their skins, are more righteous than you; for they have not forgotten the commandment of the Lord, which was given unto our fathers, that they should have, save it were one wife; and concubines they should have none; and there should not be whoredoms committed among them. And now, this commandment they observe to keep; wherefore, because of this observance, in keeping this commandment, the Lord God will not destroy them, but will be merciful unto them; and one day they shall become a blessed people."[161:B] Again:—
  • 46. "And it came to pass that Riplakish did not do that which was right in the sight of the Lord, for he did have many wives and concubines, and did lay that upon men's shoulders which was grievous to be borne; yea, he did tax them with heavy taxes; and with the taxes he did build many spacious buildings."[162:A] And again:— "And he [Noah] did not walk in the ways of his father. [Zeniff.] For behold, he did not keep the commandments of God, but he did walk after the desires of his own heart. And he had many wives and concubines. And he did cause his people to commit sin, and to do that which was abominable in the sight of the Lord. Yea, and they did commit whoredoms and all manner of wickedness. And he laid a tax of one fifth part of all they possessed." . . . "All this did he take to support himself, and his wives and his concubines; and also his priests, and their wives and their concubines; thus he had changed the affairs of the kingdom."[162:B] "And it came to pass that he placed his heart upon his riches, and he spent his time in riotous living, with his wives and his concubines; and so did also his priests spend their time with harlots."[162:C] As if to place this matter beyond any question, we have the following still more explicit testimony, on pages 115 and 118:— "And now it came to pass that the people of Nephi, under the reign of the second king, began to grow hard in their hearts and indulge themselves somewhat in wicked practices, such as like unto David of old, desiring many wives and concubines, and also Solomon his son." . . .
  • 47. "The word of God burdens me because of your grosser crimes. For behold, thus saith the Lord, this people begin to wax in iniquity; they understand not the Scriptures; for they seek to excuse themselves in committing whoredoms, because of the things which were written concerning David, and Solomon his son. Behold David and Solomon truly had many wives and concubines, which thing was abominable before me, saith the Lord: wherefore, thus saith the Lord, I have led this people forth out of the land of Jerusalem, by the power of mine arm, that I might raise up unto me a righteous branch from the fruit of the loins of Joseph. Wherefore, I the Lord God, will not suffer that this people shall do like unto them of old. Wherefore, my brethren, hear me, and hearken to the word of the Lord; for there shall not any man among you have, save it be one wife; and concubines he shall have none; for I, the Lord God, delighteth in the chastity of women. And whoredoms are an abomination before me; thus saith the Lord of Hosts."[163:A] Here it is stated as coming from God himself, that the polygamy and concubinage of David and Solomon were abominable before the Lord. And yet we every day hear David and Solomon, as well as Abraham, Jacob, and others, cited by those practising polygamy, as their illustrious prototypes, whose example is worthy of all imitation. Orson Pratt, the ablest writer on Mormon theology, is compelled to admit that the Book of Mormon is opposed to polygamy. He says: — "Do you believe that the Book of Mormon is a divine revelation? We do. Does that book teach the doctrine of plurality of wives? It does not. Does the Lord in that book forbid the plurality doctrine? He forbid the ancient Nephites to have any more than one wife."[163:B]
  • 48. Elder Pratt then endeavors to blunt the force of this testimony in the following manner:— "Why were the ancient Nephites restricted to the one- wife system? Because, first, the number of males and females among them, at the time the command was given, was about equal. Secondly, there was no probability that judgments, wars, or any other calamities which were to befall their nation, would produce a disproportionate number of males and females. Thirdly, this small remnant of the tribe of Joseph, were, at that time, about equally righteous; and one was about as capable of raising up a family in righteousness as another. And, lastly, the Lord himself informs them, in the same connection with the quotation which I have just made, that if He would have them practise differently from what He had previously taught them, it must be by His command."[164:A] Thus, in the attempt to weaken the force of the evidence furnished by the Book of Mormon against polygamy, Pratt acknowledges, in the most explicit manner, the validity of the argument against it, founded upon the equality in the numbers of each sex. Two of the four reasons why the Nephites were to retain monogamy, relate to the equality in the numbers of the sexes. But there is a substantial equality in the numbers of the sexes, not only in the United States, but in Utah Territory. (See U. S. Census.) Let us now turn to the Book of Doctrine and Covenants, and see if we can find in that volume any authority for polygamy. The following passages will determine the question:— "Thou shalt love thy wife with all thy heart, and shalt cleave unto her, and none else; and he that looketh upon a woman to lust after her, shall deny the faith, and shall not have the spirit; and if he repents not he shall be cast out."[164:B]
  • 49. Again. In 1845, the year after Smith's death, an Appendix was authoritatively added to the Book of Doctrine and Covenants, containing the following, which is extracted from the section entitled "Marriage":— "2. Marriage should be celebrated with prayer and thanksgiving; and at the solemnization, the persons to be married standing together," etc., "he [the person officiating] shall say, calling each by their names, 'you both mutually agree to be each other's companion, husband and wife, observing the legal rights belonging to this condition; that is, keeping yourselves wholly for each other, and from all others, during your lives.' And when they have answered 'yes,' he shall pronounce them 'husband and wife,' in the name of the Lord Jesus Christ and by virtue of the laws of the country, and authority vested in him. . . . "4. . . . Inasmuch as this church of Christ has been reproached with the crime of fornication and polygamy; we declare that we believe that one man should have one wife; and one woman but one husband, except in case of death, when either is at liberty to marry again."[165:A] Can anything be more explicit than this? Polygamy is not only expressly repudiated by the church, but is classed by the side of fornication as a crime. Thus we find that polygamy is contrary to both books of the Mormon Bible. That it is, in fact, strongly condemned in those volumes. It is, therefore, no part of the Mormon religion, as given to the world by Joseph Smith. But polygamy is practised in Utah. Whence did it arise, and upon what foundation does it rest?
  • 50. Like slavery, and all other great social evils, it had its origin, doubtless, in an abuse of the passions of man. It was first publicly announced and recommended in Utah Territory on the 29th of August, 1852, by Orson Pratt and Brigham Young, at a politico-religious meeting, held in Great Salt Lake City. On that occasion, President Young said:— "You heard Brother Pratt state, this morning, that a Revelation would be read this afternoon, which was given previous to Joseph's death. It contains a doctrine a small portion of the world is opposed to; but I can deliver a prophecy upon it. Though that doctrine has not been preached by the Elders, this people have believed in it for years. "The original copy of this Revelation was burnt up. William Clayton was the man who wrote it from the mouth of the Prophet. In the mean time it was in Bishop Whitney's possession. He wished the privilege to copy it, which Brother Joseph granted. Sister Emma (wife of Joseph Smith) burnt the original. The reason I mention this is, because that the people who did know of the Revelation, suppose it was not now in existence. "The Revelation will be read to you. The principle spoken upon by Brother Pratt this morning, we believe in. . . . "Many others are of the same mind. They are not ignorant of what we are doing in our social capacity. They have cried out proclaim it; but it would not do a few years ago; everything must come in its time, as there is a time to all things. I am now ready to proclaim it. "This Revelation has been in my possession many years; and who has known it? None but those who should know it. I keep a patent lock on my desk, and there does not anything leak out that should not."[166:A]
  • 51. The Revelation, so called, which was read at the close of this sermon, purports to have been given to Joseph Smith, July 12, 1843. It is very lengthy, consisting of twenty-five sections or paragraphs. It is published in full, in Burton's "City of the Saints," and in various other publications. The following synopsis exhibits all that is essential of this extraordinary Revelation. THE REVELATION. Section 1. "Verily, thus saith the Lord unto you, my servant Joseph, that inasmuch as you have inquired of my hand to know and understand wherein I, the Lord, justified my servants Abraham, Isaac, and Jacob, as also Moses, David, and Solomon, my servants, as touching the principle and doctrine of their having many wives and concubines: Behold, and lo, I am the Lord thy God, and will answer thee as touching this matter." [The balance of this section is prefatory, declaring that a new law and everlasting covenant is about to be revealed, and that he who abides not that covenant shall be damned.] Sec. 2. All covenants, contracts, vows, etc., not made and sealed by the Holy Spirit of promise, of him who is anointed (Joseph Smith) both as well for time and for all eternity, are of no efficacy or force after the resurrection. Sec. 3 represents the necessity of having everything sanctioned by the Almighty. Secs. 4 and 5. Persons married for life only, or for time and eternity, but not by the proper authority, not bound to each other after this life. Sec. 6 provides that if a man marry a wife by the law of God, and by the new and everlasting covenant, and if they abide in the covenant, and do not shed innocent blood, then the covenant shall be binding throughout time and eternity, "and they shall pass by the angels, and the gods which are set there, to their exaltation and glory in all things."
  • 52. Sec. 7 declares that such shall be gods in the eternal world. Sec. 8 states that none can receive such exaltation except those who receive and abide the law of God. Sec. 9. "Verily, verily I say unto you, if a man marry a wife according to my word, and they are sealed by the Holy Spirit of promise according to mine appointment, and he or she shall commit any sin or transgression of the new and everlasting covenant whatever, and all manner of blasphemies, and if they commit no murder wherein they shed innocent blood, yet they shall come forth in the first resurrection, and enter into their exaltation, but they shall be destroyed in the flesh, and shall be delivered unto the buffetings of Satan unto the day of redemption, saith the Lord God." Sec. 10 explains that shedding innocent blood, and assenting unto the death of Christ, is the blasphemy against the Holy Ghost, which shall not be forgiven in the world nor out of the world. Secs. 11 and 12 refer to Abraham as the father of the faithful, and him to whom the promises were made. "This promise is yours also, because ye are of Abraham, and the promise was made unto Abraham." "Go ye, therefore, and do the works of Abraham; and enter ye into my law, and ye shall be saved." Sec. 13 intimates that Sarah acted in accordance with the command of God in giving Hagar to Abraham. Sec. 14 refers to the concubines which Abraham received, and says, "they bare him children, and it was accounted unto him for righteousness." The latter part of the section is as follows: "David also received many wives and concubines, as also Solomon, and Moses my servant; and also many others of my servants, from the beginning of creation until this time; and in nothing did they sin save in those things which they received not of me." Sec. 15. "David's wives and concubines were given unto him, of me, by the hand of Nathan, my servant, and others of the prophets who had the keys of this power; and in none of these things did he sin against me, save in the case of Uriah and his wife; and therefore
  • 53. he hath fallen from his exaltation, and received his portion; and he shall not inherit them out of the world; for I gave them unto another, saith the Lord." Sec. 16 prescribes certain regulations concerning those who commit adultery, and provides that in case the husband commits adultery, and the wife is innocent, and the fact is revealed by God to Joseph, the wife shall be given by Smith to one who has not committed adultery, "but hath been faithful, for he shall be made ruler over many." Sec. 17. "And verily, verily I say unto you, that whatsoever you seal on earth shall be sealed in heaven; and whatsoever you bind on earth in my name and by my word, saith the Lord, it shall be eternally bound in the heavens; and whosesoever sins you remit on earth shall be remitted eternally in the heavens; and whosesoever sins ye retain on earth shall be retained in heaven." Sec. 18. "And again, verily I say, whomsoever you bless I will bless, and whomsoever you curse I will curse, saith the Lord; for I, the Lord, am thy God." Sec. 19. "And again, verily I say unto you, my servant Joseph, that whatsoever you give on earth, and to whomsoever you give any one on earth, by my word, and according to my law, it shall be visited with blessings, and not cursings, and with my power, saith the Lord, and shall be without condemnation, on earth and in heaven." Then follows a declaration to the effect that Smith has found favor with God, and that he will forgive his sins, etc. Sec. 20 commands Emma Smith "that she stay herself, and partake not of that which I commanded you to offer unto her; for I did it, saith the Lord, to prove you all," etc., and continues as follows: "And let mine handmaid, Emma Smith, receive all those that have been given unto my servant Joseph, and who are virtuous and pure before me; and those who are not pure, and have said they are pure, shall be destroyed, saith the Lord God; for I am the Lord thy God," etc.
  • 54. Sec. 21 commands Emma Smith, wife of Joseph, to abide and cleave unto Joseph and none else, under penalty of destruction. She is also exhorted to forgive Joseph his trespasses. Sec. 22 forbids Joseph putting his property out of his hands. Sec. 23 touches upon the law of the priesthood, and says of any one who is called of God, as was Aaron, "if he do anything in my name, and according to my law, and by my word, he will not commit sin, and I will justify him." Joseph is to be justified, etc. The last two sections are as follows:— Sec. 24. "And again, as pertaining to the law of the priesthood: if any man espouse a virgin, and desire to espouse another, and the first gives her consent; and if he espouse the second, and they are virgins, and have vowed to no other man, then he is justified; he cannot commit adultery, for they are given unto him; for he cannot commit adultery with that that belongeth unto them, and to none else; and if he have ten virgins given unto him by this law, he cannot commit adultery, for they belong to him, and they are given unto him; therefore is he justified. But if one, or either of the ten virgins, after she is espoused, shall be with another man, she has committed adultery, and shall be destroyed; for they are given unto him to multiply and replenish the earth, according to my commandment, and to fulfil the promise which was given by my Father before the foundation of the world, and for their exaltation in the eternal worlds, that they may bear the souls of men; for herein is the work of my Father continued, that he may be glorified." Sec. 25. "And again, verily, verily I say unto you, if any man have a wife who holds the keys of this power, and he teaches unto her the law of my priesthood as pertaining to these things, then shall she believe, and administer unto him, or she shall be destroyed, saith the Lord your God; for I will destroy her; for I will magnify my name upon all those who receive and abide in my law. Therefore it shall be lawful in me, if she receive not this law, for him to receive all things whatsoever I, the Lord his God, will give unto him, because she did
  • 55. not believe and administer unto him, according to my word; and she then becomes the transgressor, and he is exempt from the law of Sarah, who administered unto Abraham according to the law, when I commanded Abraham to take Hagar to wife. And now, as pertaining to this law: Verily, verily I say unto you, I will reveal more unto you hereafter; therefore let this suffice, for the present. Behold, I am Alpha and Omega. Amen." Such is the foundation upon which is built the superstructure of Utah polygamy. And the system itself, what is it in its theory and practical application? The mode of its institution has been shown. Its ceremonials, and many facts illustrative of its tendency and effects, will be given; and it is for our readers to determine how much it is better than promiscuous intercourse, and to discover, if they can, its redeeming features, as distinguished from such a state of society. No man who has a wife already, has any right to make propositions of marriage to a lady, until he has consulted the President of the whole church, and through him obtained a revelation from God upon the subject. If the revelation be favorable, he must next obtain the approbation of the parents, and thirdly, he is to consult the lady herself. It is also necessary that the first wife be consulted. If she refuses her consent, however, the lover husband may take an appeal to the President; and unless the wife can give to the President satisfactory reasons why her consent is withheld, the husband may proceed to introduce another wife into the family, against her will. The plan is, either to divorce the first wife, and damn her eternally, or to torment her daily, until, with a broken heart and a crushed spirit, she goes to the altar, and there gives another to her husband. Thus the semblance of her approbation is obtained. The exquisite cruelty of this abominable practice will appear most vividly from the marriage ceremony.
  • 56. "When the day set apart for the solemnization of the marriage ceremony has arrived, the bridegroom and the wife, and also the bride, together with their relations, and such other guests as may be invited, assemble at the place which they have appointed. The scribe then proceeds to take the names, ages, native towns, counties, States, and countries of the parties to be married, which he carefully enters on record. The President, who is the Prophet, Seer, and Revelator over the whole church, throughout the whole world, and who alone holds the keys of authority in this solemn ordinance, calls upon the bridegroom and his wife, and the bride, to arise, which they do, fronting the President. The wife stands on the left hand of her husband, while the bride stands on her left. The President then puts this question to the wife: 'Are you willing to give this woman to your husband, to be his lawful and wedded wife, for time and all eternity? If you are, you will manifest it by placing her right hand within the right hand of your husband.' The right hands of the bridegroom and the bride being thus joined, the wife takes her husband by the left arm, as if in the attitude of walking. The President then proceeds to ask the following questions of the man: 'Do you, brother, (calling him by name) take sister (calling the bride by name) by the right hand, to receive her unto yourself, to be your lawful and wedded wife, and you to be her lawful and wedded husband, for time and for all eternity, with a covenant and promise on your part, that you fulfil all the laws, rites, and ordinances pertaining to this holy matrimony, in the new and everlasting covenant,—doing this in the presence of God, angels, and these witnesses, of your own free will and choice?' The bridegroom answers, 'Yes.' The President then puts the question to the bride: 'Do you, sister, (calling her by name) take brother (calling him by name) by the right hand, and give yourself to him to be his lawful and wedded wife, for time and for all eternity, with a
  • 57. covenant and promise, on your part, that you will fulfil all the laws, rites, and ordinances pertaining to this holy matrimony, in the new and everlasting covenant,—doing this in the presence of God, angels, and these witnesses, of your own free will and choice?' The bride answers, 'Yes.' The President then says: 'In the name of the Lord Jesus Christ, and by the authority of the Holy Priesthood, I pronounce you legally and lawfully husband and wife, for time and all eternity; and I seal upon you the blessings of the holy resurrection, with power to come forth in the morning of the first resurrection, clothed with glory, immortality, and eternal lives; and I seal upon you the blessings of thrones, and dominions, and principalities, and powers, and exaltations; together with the blessings of Abraham, Isaac, and Jacob; and say unto you, be fruitful and multiply, and replenish the earth, that you may have joy and rejoicing in your posterity, in the day of the Lord Jesus. All these blessings, together with all other blessings, pertaining to the new and everlasting covenant, I seal upon your heads, and enjoin your faithfulness unto the end, by the authority of the Holy Priesthood, in the name of the Father, and of the Son, and of the Holy Ghost. Amen.'" The scribe then enters the marriage on the records, and the parties retire. The wedding is then celebrated with a feast at the husband's house, and a "Mormon dance." The new wife is assigned a room,—if indeed the happy husband's domicil contains two rooms, —and her experience in "plurality" begins. In well-regulated Mormon families, the first wife stands at the head of domestic concerns. She carries the keys of the storehouse, makes the purchases for the family, and deals them out to the plural wives, in much the same manner as other housekeepers do to their cooks. The husband's will is law, and from it there is no appeal, except in extreme cases, when the Bishop may be consulted.
  • 58. If a husband has lost his wife by death, before he had the opportunity of attending to this holy ordinance, and securing her as his lawful wife for eternity, then it is the duty of the second wife, first, to be sealed or married to the husband, for and in the name of the deceased wife, for all eternity; and, secondly, to be married for time and eternity herself, to the same man. Thus, by this holy ordinance, both the dead and the living wife will be his in the eternal worlds. But if, previous to marriage for eternity, a woman lose her husband by death, and marry a second, and if her first husband was a good man, then it is the duty of the second husband to be married to her for eternity, not for himself, but in the name of her deceased husband, while he himself can only be married to her for time; and he is obliged to enter into a covenant to deliver her up, and all her children, to her deceased husband, in the morning of the first resurrection. Thus, by these refinements, a religious veil, captivating to the fancy, is thrown over the institution to hide its deformity. The same distinctions are carried through all the various relations of life; hence in case a widow is married to a widower, three ceremonies are necessary, in order fully to establish the eternal relations of all the parties. Incest is the practical result of some of the branches of this new- fangled system of sealing and marriage. It has already been shown, by the report of the Committee on Territories in the United States Senate, and the Message of Gov. Harding, that a mother and her daughters (by a former husband) all live together, as wives of the same husband.[173:A] A still more revolting relation is sometimes maintained. It is called "heirship," and is plainly enough sanctioned by Young, as follows:— "The text is, the right of heirship. I will, however, make an addition to the scripture, before I proceed further with
  • 59. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! textbookfull.com