|
LOL AND OATES posted:yikes Careful there. There is no such type in PHP as 'nothing', that use of return with no value actually returns NULL, and NULL, 0, and false are all equal to "".
|
# ¿ Mar 24, 2008 16:40 |
|
|
# ¿ Apr 29, 2024 17:50 |
|
Zedlic posted:The problem is that the table has 14 columns, and thousands of rows. The average query will return about 2.000 rows. So that's an array with around 30.000 strings, and quite possibly a lot more. It depends what problem you are trying to solve and what resources you have in greatest abundance. The situation that I've encountered large arrays in most is when creating reports from large amounts of data; in this case I would say yes, if it's going to save you a few massive queries or expensive joins, do it. But if this is something you want to do every time someone loads a page on your website then you might have a problem. Try it out by running your script and printing out the value of get_peak_memory_usage() at the end, to see how much memory it used.
|
# ¿ Apr 17, 2008 00:00 |
|
Safety Shaun posted:Without setting a cookie, session or global variable, I need to pass a variable from index.php to a PHP script included as an image. I'm not quite sure but I think you are trying to prevent hotlinking: Check the value of $_SERVER['HTTP_REFERER'] and deny access if: a: There is a url, AND: b: The address in that URL is not your website (I don't think you can safely rely on an accurate referrer always being present).
|
# ¿ Apr 17, 2008 00:13 |
|
awdio posted:If header( 'Location: example.php' ); is placed at the top of a PHP script outside of a function, if statement or any other logic is the rest of the code guaranteed to run properly before it performs the header redirect? I don't know about guarenteed to run properly (that would be nice wouldn't it?) but outputting a header will not disrupt the execution of your script at all.
|
# ¿ May 5, 2008 18:32 |
|
Well I suppose there is kind of a border case, where if you have already outputted something that isn't a header, then you'll get an error if you try to use the header() function (but I guess you knew that).
|
# ¿ May 5, 2008 18:55 |
|
|
# ¿ Apr 29, 2024 17:50 |
|
Anveo posted:Unless you're really disk bound, memcached is going to be about 5x slower than reading off local memory, and about 2x slower than reading off the disk. Eh? How is it going to be slower than reading from the disk? Memcached stores information in memory.
|
# ¿ May 8, 2008 08:41 |