Warning: Division by zero in /var/customers/webs/stc/benchmark/index.php on line 256 Test: ord v. unpack (str keys)

PHP Benchmarks

Performance comparison of PHP code alternatives.

Test: ord() v. unpack() (str keys)

Does unpack (with its strange format string) go any faster than creating your own associative array?

Run Again Test Menu


Unfortunately, no history for this test is available.


The first test, "ord()", was:

$GLOBALS['dummy'] = array(
	'a' => ord($GLOBALS['packed']{0}),
	'b' => ord($GLOBALS['packed']{1}),
	'c' => ord($GLOBALS['packed']{2}),
	'd' => ord($GLOBALS['packed']{3}),

The second test, "unpack()", was:

$GLOBALS['dummy'] = unpack('Ca/Cb/Cc/Cd', $GLOBALS['packed']);

Running: Linux (x86_64:1 GB) PHP (7.2.25-1+ubuntu16.04.1+deb.sury.org+1)