3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (defined('HHVM_VERSION')) { exit; } function refcount($var) { ob_start(); debug_zval_dump($var); $dump = ob_get_clean(); $matches = array(); preg_match('/refcount\(([0-9]+)/', $dump, $matches); $count = $matches[1]; //3 references are added, including when calling debug_zval_dump() return $count - 3; } $array = array('foo' => 'bar'); var_dump(refcount($array)); $copy = $array; var_dump(refcount($array)); var_dump(refcount($copy)); current($copy); var_dump(refcount($array)); var_dump(refcount($copy));
Output for git.master, git.master_jit, rfc.property-hooks
int(1) int(2) int(2) int(2) int(2)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
48.98 ms | 401 KiB | 8 Q