Re: [PHP] str_replace around a character??

2011-07-13 Thread Vitalii Demianets
On Wednesday 13 July 2011 11:09:45 Jay Ess wrote: > On 2011-07-13 09:54, Karl DeSaulniers wrote: > > $cc = "ema...@domain.com ,ema...@doamin.com,ema...@domain.com , > > ema...@domain.com, " > > $cc = trim($cc,","); > $result = preg_replace('/(\s?)(,)(\s?)/i', ',', $cc); The solution is broken beca

Re: [PHP] Re: [PHP-DB] Re: radio form submission

2011-06-25 Thread Vitalii Demianets
On Saturday 25 June 2011 01:24:10 Andre Polykanine wrote: > Maybe I'm off topic, but wouldn't you consider JavaScript form > validation? That will make your task easier and the user will see > his/her error much earlier, before he/she submits the form. JavaScript validation is useful

Re: [PHP] Re: [PHP-DB] Re: radio form submission

2011-06-25 Thread Vitalii Demianets
On Friday 24 June 2011 21:44:05 Chris Stinemetz wrote: > if (!array_key_exists($_POST['store_type'], $choices)) { >   >  echo "You must select a valid choice."; Nothing wrong to me. Perfectly valid way of checking if there is

Re: [PHP] Re: [PHP-DB] Re: radio form submission

2011-06-24 Thread Vitalii Demianets
On Friday 24 June 2011 17:28:08 Chris Stinemetz wrote: > That worked perfectly! And will work, until you decide to put quotes in button name for some reason. And until some malicious user forge POST request with $_POST['post_tptest'] = "'; DROP DATABASE; --" But you can use prepared statements to

[PHP] Performance gain when not using prepared statements?

2011-06-17 Thread Vitalii Demianets
On Friday 17 June 2011 04:50:00 Daevid Vincent wrote: > > I've seen too many people over the years try and rally against common > > sense practices like using prepared statements for perhaps a marginal > > gain of performance on one page while their load averages are 0,0,0. > > Agreed. The ONLY tim

Re: [PHP] What do you get for ...

2011-06-07 Thread Vitalii Demianets
On Tuesday 07 June 2011 13:35:06 Richard Quadling wrote: > Hi. > > What do you get for ... > > php -r "var_dump(realpath(null));" > 1. PHP 5.3.6 @ Gentoo Linux(x86_64) tmp $ php -r "print getcwd();" /var/tmp tmp $ php -r "var_dump(realpath(null));" string(8) "/var/tmp" 2. PHP 5.2.14 @ Linux(ARM

Re: [PHP] simple question abt convert to integer

2011-05-25 Thread Vitalii Demianets
On Wednesday 25 May 2011 07:05:18 Negin Nickparsa wrote: > my code is this: > $query1="select * from patient where id=".$_POST['txt']; > it works but Holy Jesus! Can't wait to send to your server POST request with txt="1;DROP DATABASE; --" Of course, if you'll switch to prepare statement instead

Re: [PHP] strcmp()?

2011-05-24 Thread Vitalii Demianets
quot;; > >    echo strcmp('b', 'a'), "\n"; My result is: 13 -17 1 I'm runninng PHP 5.2.14 on the ARM Linux with uClibc. Certainly the result depends on architecture and/or libc, because PHP just calls system strcmp, nothing more. So. to write compatible scri

Re: [PHP] Bitwise AND for 31-st bit

2011-05-18 Thread Vitalii Demianets
t; > tst1=-9223372036854775808, tst1_eq=-9223372036854775808, > tst1_type=integer > tst2=9.22337203685E+18, tst2_eq=-9223372036854775808, tst2_type=double > I get similar results with 5.3 on my amd64 host too. It works as it should, no weirdness. Glad to know that 5.3 get

Re: [PHP] Bitwise AND for 31-st bit

2011-05-17 Thread Vitalii Demianets
think, I should live with it, until I manage somehow to upgrade PHP installation for that board. -- Vitalii Demianets -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Bitwise AND for 31-st bit

2011-05-17 Thread Vitalii Demianets
integer And I totally can not understand, why in the hell tst1_eq=0 ? (BTW I'm using PHP 5.2.14 on 32-bit CPU, if that matters) Sorry if this is well-known feature and have discussed before. In such a case please point me to the URL of the discussion. -- Vitalii Demianets -- PHP Genera