Introduction to PHP - Helion
ISBN: 978-13-012-6761-3
stron: 1, Format: ebook
Data wydania: 2013-12-21
Księgarnia: Helion
Cena książki: 2,10 zł
ENGLISH EDITION: "Introduction to PHP", czyli "Wprowadzenie do PHP" obejmuje nstepujące zagadnienia: składnia PHP, programowanie strukturalne i obiektowe w PHP, połączenie PHP z HTML.
Uwaga! Książka w języku angielskim
Osoby które kupowały "Introduction to PHP", wybierały także:
- PHP 8 Programming Tips, Tricks and Best Practices 157,37 zł, (29,90 zł -81%)
- Domain-Driven Design in PHP 135,91 zł, (29,90 zł -78%)
- PHP Microservices 135,91 zł, (29,90 zł -78%)
- Drupal 8 Module Development. Second edition 124,58 zł, (29,90 zł -76%)
- Mastering The Faster Web with PHP, MySQL, and JavaScript 124,58 zł, (29,90 zł -76%)
Spis treści
Introduction to PHP eBook -- spis treści
ENGLISH EDITION
CONTENTS:
CHAPTER 1: Introduction to the English edition
What and how can PHP do for us?
What for? To get visitor’s IP, for example
What do I need for beginning?
Embedding PHP code
Comments in PHP
How to use PHP interpreter online
Running PHP from the command line
Command line input (STDIN)
CHAPTER 2: PHP variables
Case sensitivity
Error messages and warnings
Data types in PHP
Using constants in PHP
Integer data type
Floating-point numbers
Bool type (Boolean values)
Null type variable and type checking in PHP
Dynamic variables
CHAPTER 3: Operators
Arithmetic operators
Assignment operator and combined operators
Pre / post - increment and decrement operators
Comparison operators
Logical operators
Base converting functions and bitwise operators
Operator precedence
Filtering mask with binary operators
CHAPTER 4: PHP Arrays, array constructor, array types in PHP
Numeric indexed arrays, runtime array size change
Associative arrays and string arrays
Character strings as 1D array
Mixed arrays
Multi-dimensional arrays, hash table
Array elements can be sorted
Internal pointer and some useful functions
CHAPTER 5: If we need conditional statements or loops
If statement (if-elseif-else) and switch-case statement
The while and do-while loops
The for and foreach loops
The break, continue and goto keywords
CHAPTER 6: PHP functions
Argument passing by value and using default values
Variable argument list
Argument passing by reference
Returning an array or modifying values by reference
Locals vs. globals
Math functions
Searching and sorting
Quick binary search
PHP runtime-created functions
Date and time
CHAPTER 7: Object oriented programming in PHP
Properties
Creating an object (a class new instance)
Constructor
Destructor
Included and required file(s)
An ERROR in PHP5 discovered
BC Math functions vs. PHP operators
PHP is one of the world’s most popular programming languages for web programming. If you work in the cloud, you can create, test and deploy your PHP projects from your browser using cloud IDEs.
PHP is like C and C++, but interpreted (not compiled) server-side universal programming language (named also the server scripting language) used for dynamic websites and interactive web applications. What is a PHP File?
* PHP files can contain text, HTML, CSS, JavaScript, and PHP code.
* PHP codes are executed on the server, and the result is returned to the browser as plain HTML.
* PHP files have extension *.php (* = file name, php = reserved extension).
* So named pure PHP files contain PHP codes only (without HTML, JavaScript, CSS).
In contrast with static HTML sites, PHP sites are dynamically generated. Instead of the site containing a large number of static HTML files, a PHP-based site may consist of only a few template files (even Single PHP pages are in use). With PHP we are not limited to output HTML. We can output images, PDF files and Flash movies or any text, such as XHTML or XML. Even all HTML code can be dynamically generated by pure PHP files.
PHP is universal programming language so it is the The Functionally Complete System like C++ or C#. In each Functionally Complete System we can implement all tasks and all algorithms which belong to certain category. But we know that sometimes it is easier and sometimes it could be more difficult and complicated. Take it easy. PHP is a convenient and effective programming tool. That is why PHP is so popular and so commonly used. Using ready to use native built-in functions in PHP you can easy implement the following.
* PHP runs on various platforms (Unix, Windows, Linux, Mac OS X, so on)
* PHP is compatible with almost all servers available (IIS, Apache, so on)
* PHP supports a wide range of databases
* PHP can create, open, read, write, and close files on the server
* PHP can send and receive cookies
* PHP can collect form data and add, delete, modify data in our database
* PHP can restrict users to access some pages on your website
* PHP can encrypt data
* PHP can compress and decompress data
* PHP comes with an extension called SimpleXML to share data and to format data into structures
* Associative and mixed multidimensional arrays allow implementing easy data records, data structures and database queries.
* Another way to implement data structures / data records in PHP is using classes or parallel arrays.
PHP was originally developed in 1994 by Rasmus Lerdorf to replace a set of Perl scripts He had been using to maintain his web site. The acronym originally stood for Personal Home Page, but when he released a version to the public the following year it was recursively retitled PHP: Hypertext Processor. Since 1995 PHP has evolved from a simple scripting language to a fully featured web programming language. The official implementation is now released by The PHP Group, with PHP 5.5.6 being the most recent version (released: 14 Nov 2013). The language is open source, allowing developers to extend it for their own use. PHP is the most popular server-side programming language used today. One of the reasons (and the most important one) is its platform independence. PHP has simple-to-use syntax based on C and Perl, which is easy to learn for a newcomer and for C/C++ programmers.
PHP is developed as a project of the Apache Software Foundation - thus, it works best with Apache. PHP also works properly with Microsoft IIS/PWS, iPlanet, and others.
When creating websites using PHP a Content Management System (CMS) is generalny considered and used. A CMS tool provides a fully integrated platform for website development consisting of a backend and a frontend.
* The frontend is what visitors see when they arrive to the site,
* The backend is where the site may be configured, updated and managed by an administrator.
The most popular examples of free PHP-based CMS tools include WordPress, Joomla, ModX and Drupal.
Many www programmers want to know first who their visitor is. It is simple to get the visitor's IP in PHP, just using the $_SERVER['REMOTE_ADDR'] variable.
print 'Your IP is: '. $ip; ?>
If the code above returns the IP of the server, there is also another way. This function returns the visitor IP (even if the $_SERVER['REMOTE_ADDR'] contains the server IP) because it gets the IP from $_SERVER['HTTP_X_FORWARDED_FOR'].
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER))
{ $x = array_pop(explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])); }
return ($x); } $www = get_IP(); print $www; ?>
This is a short and simple (but a little exciting) example of PHP power. I would like to show you at the beginning that PHP really can be interesting and useful in practice for many of us.