How much is the speed at which PHP code is processed affected by code size? For instance comments increase file size. And is it worth the time to go back and clean up all my code to combine/shorten loops, database calls, etc. in order to speed up the scripts? Will there be a worthwhile speed increase?
Also, is there a way to search for a word or phrase across many blobs in a MySQL database? Say I have a forum that stores messages in blobs, and I want to set up a search engine. Can I do this?
And is there a more elegant and easier way to format dates other than the way I have set up?
function echodate($date)
{
$canceldash=explode("-",$date);
$year=$canceldash[0];
$month=$canceldash[1];
$dashgone=$canceldash[2];
$cancelspace=explode(" ",$dashgone);
$day=$cancelspace[0];
$spacegone=$cancelspace[1];
$cancelcolon=explode(":",$spacegone);
$hour=$cancelcolon[0];
$minute=$cancelcolon[1];
$second=$cancelcolon[2];
return date("M dS H:i",mktime($hour,$minute,$second,$month,$day,$year));
}
where $date is a datetime value as obtained from a MySQL result. This way works, but is clunky and probably sacrifices a good deal of speed.
Last things: the way I have my site set up, on every page I set $title, $valign, $pagename, etc. values before including a site-universal header, outputting page content, and then including a site-universal footer file. Site-wide-needed file locations, among other things, are stored in a config object so I can update locations easily. Anyway, in my header/footer files and my config object, I've set addresses like "sitegfx/divinssider.gif" etc. However, these only work if all pages are contained in the same folder, so that the relative addresses work. Is there a way for me to easily set up my pages so they can be in their own directories and still use the header/footer/config locations? As it is now, they're all jumbled up into one directory except for graphics, and if I try to move pages to directories I end up trying to display "sitegfx/divinssider.gif" from a folder other than the root and so the file won't exist.
Thanks.
Also, is there a way to search for a word or phrase across many blobs in a MySQL database? Say I have a forum that stores messages in blobs, and I want to set up a search engine. Can I do this?
And is there a more elegant and easier way to format dates other than the way I have set up?
function echodate($date)
{
$canceldash=explode("-",$date);
$year=$canceldash[0];
$month=$canceldash[1];
$dashgone=$canceldash[2];
$cancelspace=explode(" ",$dashgone);
$day=$cancelspace[0];
$spacegone=$cancelspace[1];
$cancelcolon=explode(":",$spacegone);
$hour=$cancelcolon[0];
$minute=$cancelcolon[1];
$second=$cancelcolon[2];
return date("M dS H:i",mktime($hour,$minute,$second,$month,$day,$year));
}
where $date is a datetime value as obtained from a MySQL result. This way works, but is clunky and probably sacrifices a good deal of speed.
Last things: the way I have my site set up, on every page I set $title, $valign, $pagename, etc. values before including a site-universal header, outputting page content, and then including a site-universal footer file. Site-wide-needed file locations, among other things, are stored in a config object so I can update locations easily. Anyway, in my header/footer files and my config object, I've set addresses like "sitegfx/divinssider.gif" etc. However, these only work if all pages are contained in the same folder, so that the relative addresses work. Is there a way for me to easily set up my pages so they can be in their own directories and still use the header/footer/config locations? As it is now, they're all jumbled up into one directory except for graphics, and if I try to move pages to directories I end up trying to display "sitegfx/divinssider.gif" from a folder other than the root and so the file won't exist.
Thanks.