Re: [PHP] $$var

2011-03-06 Thread Russell Dias
Hi Ashim, These are called Variable Variables. Ideally they should be avoided, as they introduce unnecessary legibility issues. This is what it does in a nutshell, it's actually quite simple: $foo = 'bar'; $bar = 'foobar'; echo $$foo;//This prints foobar What it does is, take the value of

Re: [PHP] Stripslashes

2010-12-22 Thread Russell Dias
stripslashes() is rife with gaping security holes. For mysql insertion rely on mysql_real_escape_string() or alternatively, you can use prepared statements. For outputting data on the page you should ideally be using htmlspecialchars($var, ENT_QUOTES); cheers, Russ On Thu, Dec 23, 2010 at 6:48

Re: [PHP] My truth comes out [1]

2010-10-21 Thread Russell Dias
preg_match(/false/i, $string) ? false : true; On Thu, Oct 21, 2010 at 7:39 PM, Gary php-gene...@garydjones.name wrote: Is there any nice way to convert a string containing either TRUE or FALSE to a bool with the appropriate value? I know I can just if (strcmp... but, as the song goes on to

Re: [PHP] My truth comes out [1]

2010-10-21 Thread Russell Dias
() on the string? I've not tested it, but it looks like it should do the trick. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Russell Dias rus...@gmail.com Date: Thu, Oct 21, 2010 10:51 Subject: [PHP] My truth comes out [1] To: php-general@lists.php.net

Re: [PHP] My truth comes out [1]

2010-10-21 Thread Russell Dias
a direct string comparison. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Russell Dias rus...@gmail.com Date: Thu, Oct 21, 2010 11:03 Subject: [PHP] My truth comes out [1] To: a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk Cc: php-general@lists.php.net

Re: [PHP] Re: My truth comes out [1]

2010-10-21 Thread Russell Dias
I would stay clear of the ternary operator in nested coditions, for obvious reasons. If it can fit in a single line and is essentially clear in its message I dont see why not to use it. On Thu, Oct 21, 2010 at 8:39 PM, Gary php-gene...@garydjones.name wrote: Russell Dias wrote: preg_match

[PHP] Scraping Multiple sites

2010-10-02 Thread Russell Dias
I'm currently stuck on a little problem. I'm using cURL in conjunction with DOMDocument and Xpath to scrape data from a couple of websites. Please note that is only for personal and educational purposes. Right now I have 5 independent scripts (that traverse through 5 websites) that run via a cron