This repository is designed to provide examples for the PHP 8 for PHP Developers course. For more information see https://phptraining.net/courses/php8
- Install Docker
- If you are running Windows, start here: https://docs.docker.com/docker-for-windows/install/.
- If you are on a Mac, start here: https://docs.docker.com/docker-for-mac/install/.
- If you are on Linux, have a look here: https://docs.docker.com/engine/install/.
- Install Docker Compose. For all operating systems, start here: https://docs.docker.com/compose/install/.
- Install the source code associated with this book onto your local computer.
- If you have installed git, use the following command:
git clone https://github.com/phpcl/phpcl_core_php8_developers.git
* Otherwise, you can simply download and unzip from this URL: [https://github.com/phpcl/phpcl_core_php8_developers/archive/master.zip](https://github.com/phpcl/phpcl_core_php8_developers/archive/master.zip)
* And then unzip into a folder you create which we refer to as `/path/to/repo` in this guide
- Build docker container associated with this book online:
- From your local computer, open a command prompt (terminal window).
- Change directory to
/path/to/repo
. - First time only, open a terminal window/command prompt and issue this command to build the environment:
cd /path/to/repo
docker-compose build
* Please note that the initial build might take up to 15 minutes to complete depending on your connection speed.
- Issue this command the bring the container online:
- From your local computer, open a command prompt (terminal window):
cd /path/to/repo
docker-compose up -d
* Note that this will also do `build` if you prefer to skip step 4
- To access the running docker container web server:
- Open the browser on your local computer
- To access PHP 8 enter this URL:
http://localhost:8888
- To access PHP 7 enter this URL:
http://localhost:7777
- To open a command shell into the running docker container:
- From your local computer, open a command prompt (terminal window).
- To access PHP 7:
docker exec -it php8_tips_php7 /bin/bash
- To access PHP 8:
docker exec -it php8_tips_php8 /bin/bash
- When you are finished working with the container, bring it offline using the following command:
cd /path/to/repo
docker-compose down
Sample database:
- Database Name:
phpcl
- Database User:
phpcl
- Database Password:
password
- Database Access via phpMyAdmin:
- PHP 7:
http://localhost:7777/phpmyadmin
- PHP 8:
http://localhost:8888/phpmyadmin
- PHP 7:
- Slide: Database Extension Gotchas
- Switch refs for
MySQLi
andPgSQL
- Switch refs for
- Slide: GD Extension Gotchas
- the
--with-png-dir=DIR
option has been removed - need
libpng
- the
- http://localhost:8888/run.php?file=core_ext_reflection_signature.php
- results are identical in 7 and 8: ???
- The example that uses mb_??? and accepts an ASCII code point
- results are identical in 7 and 8: ???
- Slide: Zip/ZipArchive Extension Gotchas
- S/be the following methods have been added (not functions!)
- slide: s/be ZipArchive class (not extension)
- Slide: Static Return Type
- SQL INSERT statement
- Example lacking ";":
core_imp_deref_str.php
- Slide: Illegal Sort Functions
- Code block, "illegal" callback should have ">"
- "<=>" is legal!
core_ext_tokenizer.php
- Not working
core_ext_datetime_zone.php
- Appears not to recognize the
ST
timezone
- Appears not to recognize the
- Slide: Deprecations: Enchant
- Needs formatting improvement