Găsiți următorul dvs. carte preferat

Deveniți un membru astăzi și citiți gratuit pentru 30 zile
Introduction to PHP, Part 4, Second Edition

Introduction to PHP, Part 4, Second Edition

Citiți previzualizarea

Introduction to PHP, Part 4, Second Edition

Lungime:
94 pages
44 minutes
Lansat:
Mar 1, 2015
ISBN:
9781311858832
Format:
Carte

Descriere

The book describes: classes (continuation of the Part 2 and Part 3), interfaces, traits, tuples, namespaces, ADT, randomizing, HTML, PHP & JavaScript intermixing.

Lansat:
Mar 1, 2015
ISBN:
9781311858832
Format:
Carte

Despre autor


Legat de Introduction to PHP, Part 4, Second Edition

Cărți conex
Articole conexe

Previzualizare carte

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

Introduction to PHP

Part IV

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

PART IV

CONTENTS:

Let’s take a look again (without HEREDOC)

CHAPTER 11: Classes, objects and traits in use

Generating HTML page using PHP classes

A few words about PHP scope

Interfaces

Abstract data types (ADT) and the abstract keyword

Polymorphism

Traits

Randomized numbers and strings

CHAPTER 12: Intermixing PHP and HTML, JavaScript, OS commands

Intermixing PHP and HTML

Using intermixed PHP and JavaScript codes

How to transfer data from PHP variable to JavaScript variable?

How to transfer data from JavaScript variable to PHP variable?

PHP intermixing with JavaScript, how it works?

Transferring data from PHP variables to JavaScript again

PHP interaction with operating system and file system

Pointing to an external process

Basic file-related functions

CHAPTER 13: Effective programming using functions and classes

Algorithm complexity and recursive functions

Fibonacci sequence and factorials

Programming errors

The is_datatype() group

Better encapsulation: using __set() and __get() methods

Property and function overloading

More about lambda functions and closures

Namespaces

Namespace aliases

CHAPTER 14: A few advanced topics simply explained

A few words about error handling

Function call - time measuring

The NaN and Infinity errors

Exception handling

Shared operating memory in PHP

A few words about data encryption in PHP

Tuples in PHP

Let’s take a look again (without HEREDOC)

Let’s take a look at the previous example again to compare it with a new object-oriented version shown later.

Generating HTML page using PHP functions

(PHP code from the Part III repeated, excluding HEREDOC constructions used in previous version)

date_default_timezone_set('UTC');

// Generates the top of the page

function addHeader($page, $title) {

$page .= "$title

center\">$title

;

return $page;

}

// Generates the bottom of the page

function addFooter($page, $year, $copyright) {

$page .= "

© $year $copyright

";

return $page;

}

// Initialize the page variable

$page = '';

// Add the header to the page

$page = addHeader($page, 'Adam Majczak: PHP Script');

// Add something to the body of the page

$page .=

This page was generated with a PHP script

;

// Add the footer to the page

$page = addFooter($page, date('Y'), ' Adam Majczak.');

// Display the page

print $page;

?>

// printout:

Adam Majczak: PHP Script

This page was generated with a PHP script

© 2015 Adam Majczak.

This simple code generates the following HTML code:

Adam Majczak: PHP Script

center>Adam Majczak: PHP Script

center>This page was generated with a PHP script

center>© 2013 Adam Majczak.

looking at a client browser window like this:

Pic. 16. The code in action (client browser).

CHAPTER 11: Classes, objects and traits in use

Generating HTML page using PHP classes

HTML codes can be generated using PHP functions or using PHP classes and objects. It is the time for a short review of PHP classes and objects in use. In the previous Chapter

Ați ajuns la sfârșitul acestei previzualizări. Înscrieți-vă pentru a citi mai multe!
Pagina 1 din 1

Recenzii

Ce părere au oamenii despre Introduction to PHP, Part 4, Second Edition

0
0 evaluări / 0 Recenzii
Ce părere aveți?
Evaluare: 0 din 5 stele

Recenziile cititorilor