The future of PHP: a look at what PHP 9 will bring

← The future of PHP: a look at what PHP 9 will bring

Ashterix

docs: English JsonRpcBundle docs, REST and MCP Bundle sections, package cards

en/articles/from-tg/php/php-9.md new file +89 βˆ’0

1 + # The future of PHP: a look at what PHP 9 will bring
2 +
3 + PHP is more alive than ever 😎
4 +
5 + And although some people still consider it a "dinosaur", the language keeps evolving. PHP 9.0 may become the very moment when "magic" gives way to cleanliness, and unexpected tricks give way to predictability.
6 +
7 + :::note
8 + There is no official date for PHP 9 yet, but the RFC discussions are already heating up.
9 +
10 + After 8.5 (and maybe 8.6) we will get a stricter, more logical and, importantly, stable PHP.
11 + :::
12 +
13 + So if you don't follow the RFCs yet, I'll share this information with you.
14 +
15 + ## 1. The ++ / -- operators will become more honest
16 +
17 + No more weird conversions of strings into numbers.
18 +
19 + ```php
20 + $a = 'a9';
21 + $a++;
22 + // PHP < 9.0 -> 'b0'
23 + // PHP 9.0 -> TypeError
24 + ```
25 +
26 + Less "magic".
27 +
28 + ## 2. unserialize() will throw exceptions
29 +
30 + ```php
31 + try {
32 + $obj = unserialize($data);
33 + } catch (UnserializationFailedException $e) {
34 + // handle
35 + }
36 + ```
37 +
38 + An exception instead of a warning.
39 +
40 + ## 3. Fewer type overrides
41 +
42 + ```php
43 + $arr = false;
44 + $arr[] = 2;
45 + // PHP < 9.0 -> [2]
46 + // PHP 9.0 -> Error
47 + ```
48 +
49 + Now it will be an error rather than shooting yourself in the foot.
50 +
51 + ## 4. String interpolation β€” without extra magic
52 +
53 + ```php
54 + $name = "Alex";
55 + echo "Hello $name"; // βœ…
56 + echo "Hello {$name}"; // βœ…
57 + echo "Hello ${name}"; // ❌ Deprecation
58 + ```
59 +
60 + Bringing everything to a single standard.
61 +
62 + ## 5. Warning == fatal error
63 +
64 + Undefined variables, properties or access to null will no longer get through "somehow".
65 +
66 + ```php
67 + echo $undefinedVar;
68 + // PHP < 9.0 -> Warning
69 + // PHP 9.0 -> Fatal error
70 + ```
71 +
72 + PHP will be more demanding about code quality β€” and that's a good thing.
73 +
74 + ## 6. Cleaning out old "stuff"
75 +
76 + Old-style constructors, deprecated functions, non-standard logic β€” all of this will go to the archive.
77 +
78 + Less junk, less ambiguity.
79 +
80 + ## Summary
81 +
82 + > PHP 9.0 should radically change the approach to writing code and its culture.
83 + > Less permissiveness, more control.
84 +
85 + If your code is already clean, strictly typed and free of magic, you have nothing to fear πŸ’ͺ
86 +
87 + ---
88 +
89 + *First published in Ukrainian in the Telegram channel [β€œCreated to die”](https://t.me/php_while_true/69) on October 14, 2025.*