Mega Code Archive

 
Categories / Php / Data Type
 

Add the prefix pts to each array key and then make each variable that results into a reference

<?php  $points = array('home' => 21, 'away' => 13);  extract($points, EXTR_REFS|EXTR_PREFIX_ALL, 'pts');  $pts_home -= 4;  $pts_away += 6;  printf("<p>%s</p>", var_export($points, TRUE));  ?>