Synchronize new changes to the file without re-opening the same file again. fsync()
would also throw a warning when the file is not a file pointer. The interface is: fsync(resource $stream): bool
.
Month: November 2021
PHP 8.1 – MySQLi: binding multiple values
MySQLi is gettng a feature to bind arrays to execute($array)
method in single call. This would apply to standard int
index based arrays and associative arrays.
PHP 8.1 – MySQLi: fetch_column()
New function was added to retrieve first or any other column from the result set to MySQLi
object. This follows the fetchColumn()
method from PDO and behaves in the same manner.
PHP 8.1 – Default MySQLi Error Mode
The default error mode for mysqli
calls is now changed from silent mode to Exception mode. This doesn’t affect PDO
object since PHP Data Object is already throwing Exception by default.
PHP 8.1 – Secured $GLOBALS array
Not much would care about this one, but it’s worth to mention that previously you could override the whole $GLOBALS
variable with your custom data, now you can only modify its keys/aliases.
PHP 8.1 – New octal integer notation
Forget about a case of checking 016 == 16
causing a false response, from now on any octal integer will have to be written in literal notation, which is 0o16
. This only applies to integer types, strings behavior are kept intact.
PHP 8.1 – New feature array_is_list()
Added a new check to array
to see if it contains only an int based keys in natural order (from 0 to n`). Useful when we want to ensure the array is consistent (untouched) and when we want to serialize an array
to json
to format of [0, 1, 2]
instead of object properties.
PHP 8.1 – Support of merging string keys via Spread Operator
Start merging arrays without array_merge()
completely. Spread Operator have now a support of integer types of keys, as well as string types keys. So you can merge your arrays more safe than before. Merge away!
Read morePHP 8.1 – Support of merging string keys via Spread Operator
PHP 8.1 – Deprecation when you pass NULL to non-null param
So you have some random null
values passed over to internal PHP function for non-null params? Well you are in trouble in PHP 8.1 and even more trouble when PHP 9 would pop in.
Read morePHP 8.1 – Deprecation when you pass NULL to non-null param
PHP 8.1 – ENUMS are here!
Limit your variables with pre-selected values setup by using new scalar type of enum
and by as cool and fun as JAVA or C# developers!