Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- define ('COUNT', 10000);
- $start = microtime(true);
- for ($i = 0; $i < COUNT; $i++) {
- $object = (object) array(
- 'hello' => 'world',
- 'this' => 'is',
- 'a' => 'test'
- );
- $x = $object->hello;
- $x = $object->this;
- $x = $object->a;
- }
- echo 'Object took ' . (microtime(true) - $start) . ' seconds<br />';
- $time = microtime(true);
- for ($i = 0; $i < COUNT; $i++) {
- $object = array(
- 'hello' => 'world',
- 'this' => 'is',
- 'a' => 'test'
- );
- $x = $object['hello'];
- $x = $object['this'];
- $x = $object['a'];
- }
- echo 'Array took ' . (microtime(true) - $start) . ' seconds<br />';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement