Skip to content

Latest commit

 

History

History
117 lines (100 loc) · 4.14 KB

php-cert-jun-2020.md

File metadata and controls

117 lines (100 loc) · 4.14 KB

PHP Test Prep -- June 2020

Note to Self

  • Check on when to deliver mock exams

Schedule

  • Tue 02 Jun: 1 - 2
  • Thu 04 Jun: 3
  • Tue 09 Jun: 4 - 5
  • Thu 11 Jun: 7 - 8 (finish up to and including "Magic Methods")
  • Tue 16 Jun: 8 - 10 (finish up to and including "Escaping")
  • Thu 17 Jun: 10 - 12

Notes

Bitwise AND
0 & 0 = 0
0 & 1 = 0
1 & 0 = 0
1 & 1 = 1

Bitwise OR
0 | 0 = 0
0 | 1 = 1
1 | 0 = 1
1 | 1 = 1

Bitwise XOR
0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0
echo ~(($a | $b) ^ $c) ? 'T' : 'F';
// from Catalin-Marius to All Participants:
(0010 | 0101) = 0111 ^ 0111 = ~0000 = 1111 => 'T'

XPath / XML

SOAP

DateTime

Strings

  • Be "glancingly familiar" with the string functions, especially those starting with str*
    • Letter i indicates case-insensitive
    • Letter r indicates in reverse
    • Letter u indicates user-defined callback
  • printf family
    • Format codes documents under sprintf
    • Make sure you understand the basic format codes

Regex

Various preg* examples: https://github.com/dbierer/classic_php_examples/tree/master/regex

OOP

  • Example on PDF page 297 (slide 8/16) generates warning, which was fixed in PHP 7.4:
Warning: Declaration of Container\ControllerServiceContainer::set(string $name, $value) should be compatible with Container\ServiceContainer::set($name, $value)
  • Example on PDF page 308 (slide 8/27): use syntax should be as follows. Curly braces are not appropriate in this situation.
use FactoryInterface, IndexControllerFactory;
  • Example on PDF page 308 (slide 8/27): the abstract method set() is not defined which means a fatal error will be generated

Magic Methods

You will be responsible for all magic methods except for:

SPL

Make sure you are "glancingly familiar" with the SPL

Late Static Binding

Read the explanation: https://www.php.net/manual/en/language.oop5.late-static-bindings.php

Traits

  • Traits are affected by namespace
  • Make sure you're familiar with use / as / insteadof with reference to traits

Security

random_int(int $min, int $max);

Database

Notes from PDO::bindValue():

  • What the bindValue() docs fail to explain without reading them very carefully is that bindParam() is passed to PDO byref - whereas bindValue() isn't. Thus with bindValue() you can do something like $stmt->bindValue(":something", "bind this"); whereas with bindParam() it will fail because you can't pass a string by reference, for example.
  • http://localhost:8888/#/9/26: PDOException is never thrown because the error mode is not set!

Exceptions

ERRATA

  • 4/42: correct answer: 255 255.000000
  • 5/17: array_search(): Returns element key value, or boolean false. A third boolean parameter includes type checking.