Skip to content

phpcl/phpcl_core_php8_developers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP-CL Core: PHP 8 for Developers

This repository is designed to provide examples for the PHP 8 for PHP Developers course. For more information see https://phptraining.net/courses/php8

Local Setup Procedure

  1. Install Docker
  2. Install Docker Compose. For all operating systems, start here: https://docs.docker.com/compose/install/.
  3. 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
  1. 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.
  1. 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
  1. 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
  2. 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
  3. When you are finished working with the container, bring it offline using the following command:
cd /path/to/repo
docker-compose down

Usage Information

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

ERRATA

  • Slide: Database Extension Gotchas
    • Switch refs for MySQLi and PgSQL
  • Slide: GD Extension Gotchas
    • the --with-png-dir=DIR option has been removed
    • need libpng
  • 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
  • Slide: Deprecations: Enchant
    • Needs formatting improvement