- Documentation on
--enable-zend-multibyte
- For Wed 5 May 2021
- Quizzes for Section 7 (Functions)
- Quizzes for Section 8 (OOP)
- 2nd Mock Exam!!
- For Mon 3 May 2021
- Quizzes for Section 4 (Strings and Patterns)
- Quizzes for Section 5 (Arrays)
- Quizzes for Section 6 (I/O)
- First Mock Exam!
- Detailed list of topic areas:
- Bitwise tutorial:
php.ini
settings:- Extensions
- Garbage Collection
- XML
- https://www.w3schools.com/xml/xpath_intro.asp
- Great study of Soap + XML vs. REST + JSON
- DateTime
- Examples of
DateInterval
format codes: https://www.php.net/manual/en/dateinterval.createfromdatestring.php - Formats: https://www.php.net/manual/en/datetime.formats.php
- Yes, there is a date function that calculates Easter Day :-)
- Examples of
- Alternate character encoding
- Can be set per script using
declare()
zend.multibyte=1
php.ini directive required- MB String extension required
- Unable to find any reference to
--enable-zend-multibyte
option in PHP 7.1configure --help
- See: https://www.php.net/manual/en/control-structures.declare.php
- Can be set per script using
- Security
- Test is based on this: https://www.php.net/manual/en/security.php
- https://www.php.net/manual/en/ref.session.php
- Make sure you're up to speed on magic methods
- Be sure to study the
Serializable
interface! - Late Static Binding
- Traits
- Super important: make sure you study up on
ArrayObject
- Install
docker
- CentOS: https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-ce
- Debian: https://docs.docker.com/install/linux/docker-ce/debian/
- Fedora: https://docs.docker.com/install/linux/docker-ce/fedora/
- Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/
- Windows: https://docs.docker.com/docker-for-windows/install/
- Mac: https://docs.docker.com/docker-for-mac/install/
- Install
docker-compose
- Unzip the zip file provided by your instructor into a directory
/path/to/repo
- From a terminal windows (or command prompt):
cd /path/to/repo
docker-compose build
- To run the image:
docker-compose up -d
- To access the image from a browser:
http://10.30.30.30/php_cert
// or
http://localhost:8888/php_cert
- To open a shell into the container:
- From Linux:
docker exec -it php_cert /bin/bash
- From Windows or Mac
- Locate the running container in Docker Desktop
- Click on the CLI
>_
icon to open a shell
- To access the database:
- From the CLI:
mysql -u root zend
- From the CLI:
- Code examples are located (inside the container) in
/srv/code
- https://github.com/dbierer/php-class-notes/blob/master/php-cert-aug-2020.md
- https://github.com/dbierer/php-class-notes/blob/master/php-cert-jun-2020.md
- 2/56/84: correct answer s/be B and C.
- PSR-4 is only applicable if the question addresses directory structure and namespace.
- Also, the test does not address the PSR standards.
- Finally: the PSR-4 standard wasn't available when PHP 7.1 was introduced (verify)
- 2/58/85: question contradicts the answer.
- Mara + Kinga: D; Chloris: A
- Better question: what is the output of the following?
- A. "HelloWORLD" and a Notice
- B. "HELLOWorld" and a Warning
- C. "HelloWorld"
- D. None of the above
<?php
// see: 02-58-85.php in this repo
namespace X {
define('HELLO', 'Hello');
const WORLD = 'World';
}
namespace Y {
echo HELLO . WORLD;
}
// output: "HelloWORLD" + Notice: undefined constant
- 2/67: Answer s/ have " 16"
- 4/41/175: correct answer:
255 255.000000
- 4/57: old question left over from PHP 5.5 exam: ignore
- Should be rewritten as follows: "C. The zend.multibyte php.ini setting must be enabled"
- 5/17: array_search(): Returns element key value, or boolean false. A third boolean parameter includes type checking.
- Mock Exam #2: "Given that $fp is a stream resource, enter the function that outputs a file's contents"
- Correct Answer:
fpassthru
- Correct Answer:
- 12/8/???: "Aggregate Catch Blocks"
- Example doesn't help. How about this:
try {
$pdo = new PDO($params);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException | ArgumentCountException $e) {
error_log('Database error: ' . date('Y-m-d H:i:s'));
} finally {
echo 'Database connection ';
echo ($pdo) ? 'succeeded' : 'failed';
}
- Mock Exam 2
- "Of the options given, which satisfy the array type hint?"
- There is not array type hint!
- "Of the options given, which satisfy the array type hint?"