Programming PHP 4th Edition Peter Macintyre pdf download
Programming PHP 4th Edition Peter Macintyre pdf download
download
https://textbookfull.com/product/programming-php-4th-edition-
peter-macintyre/
https://textbookfull.com/product/learn-java-for-android-
development-migrating-java-se-programming-skills-to-mobile-
development-4th-edition-peter-spath/
https://textbookfull.com/product/programming-language-concepts-
peter-sestoft/
https://textbookfull.com/product/lumen-programming-guide-writing-
php-microservices-rest-and-web-service-apis-1st-edition-paul-
redmond-auth/
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/
https://textbookfull.com/product/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-rob-aley/
https://textbookfull.com/product/computer-programming-and-
utilization-4e-4th-edition-e-balagurusamy/
https://textbookfull.com/product/advanced-apex-programming-in-
salesforce-4th-edition-dan-appleman/
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
Copyright © 2020 Kevin Tatroe and Peter MacIntyre. All rights reserved.
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.
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
—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.
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!
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 HTML content.
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 MySQL or 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).
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.
NoSQL concepts 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 XML data.
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.
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.
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.
"Territory of Utah,
ss.
Great Salt Lake City.
Again:—
"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]
"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]
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:—
"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":—
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."
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:—
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.
textbookfull.com