quotes legacy • array_key_exists() with objects • FILTER_SANITIZE_MAGIC_QUOTES filter • Reflection export() methods • mb_strrpos() with encoding as 3rd argument • implode() parameter order mix • Unbinding $this from non-static closures • hebrevc() function • convert_cyr_string() function • money_format() function • ezmlm_hash() function • restore_include_path() function • allow_url_include ini directive
platform- and transport-neutral data interchange mechanism designed to pass data between different environments and different computers. https://en.wikipedia.org/wiki/WDDX
ext/mbstring. While the two latter extensions rely on POSIX iconv support or libiconv, and the bundled libmbfl, respectively, ext/recode relies on the Recode library which is decomissioned and had its latest release on 22 January 2001.
will throw a single E_WARNING, as accessing ($a[1])[2] // is attempting to access a IS_VAR chain that is NULL. // Output would be: // Warning: Variable of type boolean does not accept array offsets https://3v4l.org/QL5Gq
will throw an E_WARNING, as accessing $a[0] is valid // [1] is accessing an integer as an array. // Output would be: // Warning: Variable of type integer does not accept array offsets https://3v4l.org/v1E9J
var_dump($a[0][0] + $c[0]); // This will through 2 E_WARNINGS, First would be $a[0][0] // For the same reason as above, $a[0] is rightfully NULL // and accessing [0] on null is invalid. The second, // would be $c[0] for the same reason. // Output: // int(0) https://3v4l.org/V8qHp
etc) are very accepting with their input arguments, you can pass any string to to them and they give a best effort of converting it. For example base_convert(“hello world”, 16, 10); will return 237 with no warnings. What this does internally is base_convert(“ed”, 16, 10); https://3v4l.org/3Jbem Also negative numbers simply do not work, eg base_convert(“-ff”, 16, 10); will return 255. (similar to above the “-” gets silently ignored). https://3v4l.org/nTaIL
$discount = 135_00; // $135, stored as cents var_dump($discount); $testValue = 107_925_284.88; // scale is hundreds of millions var_dump($testValue); https://3v4l.org/mYEs5
the same $this->request->data['comments']['user_id'] = $this->request->data['comments']['user_id'] ?? 'value'; // Instead of repeating variables with long names, the equal coalesce operator is used $this->request->data['comments']['user_id'] ??= 'value';
to combine the generality of Serializable with the implementation approach of __sleep()/__wakeup(). Two new magic methods are added: // Returns array containing all the necessary state of the object. public function __serialize(): array; // Restores the object state from the given data array. public function __unserialize(array $data): void;
$z); } interface B extends A { // permitted function m($z): A; } interface X { function m(Y $z): X; } interface Y extends X { // not permitted but type-safe function m(X $z): Y; }
loading libc and exporting function printf() $ffi = FFI::cdef( "int printf(const char *format, ...);", // this is a regular C declaration "libc.so.6"); // call C's printf() $ffi->printf("Hello %s!\n", "world"); ?>
memory ◦ Manual process via “preload file” • Everything is available for all following requests • Preloaded classes are now as fast as native function (strlen, \Exception, etc…) • Server restart is needed to “refresh” code
var/cache/dev/srcApp_KernelDevDebugContainer.preload.php // This file has been auto-generated by the Symfony Dependency Injection Component // You can reference it in the "opcache.preload" php.ini setting on PHP >= 7.4 when preloading is desired use Symfony\Component\DependencyInjection\Dumper\Preloader; require dirname(__DIR__, 3).'/vendor/autoload.php'; require __DIR__.'/ContainerZxvZ783/srcApp_KernelDevDebugContainer.php'; $classes = []; $classes[] = 'App\Kernel'; Preloader::preload($classes);
keep the discussion going here as a central point for people interested in the topic to coordinate. But just to be clear, I am fairly confident that in the near future we are not going to add anything to Composer relating to preloading. If in a year it turns out - after people have been playing with it - that there is something Composer is uniquely positioned to really help with, we can revisit. For now it seems to me much more like an application/deployment concern than a dependency management one.