Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Introduction to PHP, Part 3, Second Edition
Introduction to PHP, Part 3, Second Edition
Introduction to PHP, Part 3, Second Edition
Ebook59 pages28 minutes

Introduction to PHP, Part 3, Second Edition

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Introduction to PHP, Part 3, Second Edition describes Object-Oriented Programming (OOP) in PHP (beginning - being continued by the Part 3 and Part 4).

LanguageEnglish
PublisherAdam Majczak
Release dateFeb 24, 2015
ISBN9781310021619
Introduction to PHP, Part 3, Second Edition

Read more from Adam Majczak

Related to Introduction to PHP, Part 3, Second Edition

Related ebooks

Programming For You

View More

Related articles

Reviews for Introduction to PHP, Part 3, Second Edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Introduction to PHP, Part 3, Second Edition - Adam Majczak

    Introduction to PHP

    Part III

    Adam Majczak

    C. Adam Majczak, 2015, All Rights Reserved

    Smashwords: Second English Edition

    (improved and updated)

    E-Edition, License Notes

    This e-book is licensed for your personal use only. This e-book may not be re-sold or given away to others. To share this book with another person, please purchase an additional copy for each recipient.

    While every precaution has been taken in the preparation of this book, the publisher and the author assume no responsibility for errors or omissions, or any for damages resulting from any use of the information contained herein.

    ENGLISH EDITION

    CONTENTS:

    PART 3:

    CHAPTER 8: Date and time

    Introduction: date() and time() functions

    Timezone

    The getdate() function

    Date validation: checkdate()

    Simple timezone geolocation

    CHAPTER 9: Introduction to OOP

    Encapsulation, abstraction, inheritance and so on…

    What is a class?

    Properties and methods

    Creating an object (a class new instance)

    Visibility and scope

    Constructor

    Destructor

    Included and required file(s)

    Simple object cloning

    CHAPTER 10: A little more of OOP

    PHP does not support constructor overloading

    Static local variables

    Static class members and methods

    Declaring constants within classes

    Magic constants

    Static properties in use

    Recommended OOP practice and The Gold Rule

    BC Math functions vs. PHP operators

    Inheritance – first glance

    Overriding class members

    Final keyword and instanceof operator

    Access levels before and after inheritance

    Generating HTML page using PHP functions

    See also:

    https://www.smashwords.com/books/view/521880

    https://www.smashwords.com/books/view/522075

    ENGLISH EDITION

    CHAPTER 8: Date and time

    Introduction: date() and time() functions

    When we want to show what date and time is now, we can use the date() PHP native function:

    // function signature

    string date ( string format [, int timestamp])

    The UNIX [timestamp] is optional here and it displays the current time in seconds passed since January 1, 1970, 00:00:00 GMT and can be received as:

    $timestamp = time();

    echo $timestamp;

    The formatting string [string format] above can contain the following input parameters:

    Character / Description

    a - Lowercase Ante meridiem and Post meridiem (am/pm)

    A - Uppercase Ante meridiem and Post meridiem (AM/PM)

    B - Swatch Internet time

    d - Day of the month, 2 digits with leading zeros

    D - A textual representation of a

    Enjoying the preview?
    Page 1 of 1