Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@khards
khards / php-7.2-objects-faster-than-arrays.php
Last active July 10, 2020 07:11
This gist is to show that in php objects are much fater than arrays when you need to modify the passed object/array's contents.
<?php
/**
* Test on PHP 7.2 and PHP 5.4
*
** This gist is to show that in php7.2 objects are much fater than arrays.
**
** 1: We create an object with 10 million properties
** We pass it to a function 99999 times and modify a property
** We pass it to a function by reference 99999 times and modify a parameter
**