...

View Full Version : storing vs not



jeromepelletier
03-19-2007, 03:17 AM
what is more efficient?

printing $database[somevar] a couple times in your code or manipulting it , such as multiplying it by 2, or storing it under $myvar and using $myvar?

or is there no difference?

dniwebdesign
03-19-2007, 05:00 AM
In my honest opinion I find no real difference, but I'm sure you will get the odd guy that will argue that it makes a difference. I however found that certain operations didn't work with the array value but did with the regular variable.

Forsaken
03-19-2007, 05:22 AM
well depends on the situation you are using it, if you have an array of information and need all of them to be multiplied by 2 or need every other one multiplied by 2 you would use an array with a for loop. It also really makes no difference ans is more a personal preference than anything else as dniwebdesign stated.

jeromepelletier
03-19-2007, 05:28 AM
alright cool! thanks :) saved me some trouble :P

firepages
03-19-2007, 04:14 PM
I hate code like ...


<?php
$r=mysql_fetch_assoc($q);
$var1 =$r['var1'];
$var2=$r['var2'];
//.... etc etc//
$var20=$r['var20'];
?>


I don't see the point unless one really needs the typing practice ?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum