| Performance Tuning PHP |
 |
2025-12-25 |
 |
 |

50 |
 |
 |
Optimize passing of large objects by passing them by reference (PHP 4).
<?php
function display_function(&$obj) { ... }
$obj = mysql_fetch_object($result);
display_function($obj);
?>
When modifying complex or large variables inside a function/method.
<?php
function template_apply(&$str)
{
$str = str_replace(..., ..., $str);
}
?>
Simplify and Speed up access to large multi-dimensional arrays
<?php
$foo =& $bar['foo']['bar']['test'];
$foo['imp'] = implode(',', $foo);
$foo['imp'] = addslashes($foo['imp']);
?>