~/talk

PHP's type system dissected

Talkat phpday 2023 · 2023-05-18..05-19· [php]
slides:none on file

Explains what each PHP type actually means, how the engine checks them and how Liskov's Subtitution Principle is implemented for PHP's subtyping relation, walking through the C-level zval / ztype internals and the canonical DNF union/intersection algorithm used for subtype checks. Demonstrates ten concrete type‑juggling contexts with surprising gotchas (GMP and tidy casts, exit converting booleans to strings, deprecated float→int coercion), shows strict_types only disables scalar coercion for function args/returns/properties, and sketches proposals: function types, generics, type aliases and in/out params.

AI-written summary · about

  1. 0:00PHP's type system intro
  2. 1:07Type system overview
  3. 3:15Primitive types explained
  4. 5:27Value and callable types
  5. 6:30Composite and DNF types
  6. 8:18Union vs intersection types
  7. 10:47Zval internals
  8. 12:16Subtyping and Liskov Substitution Principle
  9. 15:30LSP in method signatures
  10. 19:07Subtyping math
  11. 20:55Future PHP type features
  12. 23:43Type juggling overview
  13. 24:24String and int juggling
  14. 27:39Logical and comparison juggling
  15. 32:15Function type promotion
  16. 35:29Increment/decrement quirks
  17. 38:19String increment issues
  18. 38:39Array offset inconsistencies
  19. 41:52Exit function behavior
  20. 43:17Strict types limits
  21. 44:45Critique of strict types
  22. 45:09Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.