RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrea Giammarchi
So while we can debate computing considerations of today, tomorrow those will be less important. That was the point I was making. Why not focus on things that make significant difference and let the insignificant fade into history. I tendentiously focus on all things able to make, all

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread clancy_1
On Tue, 6 Oct 2009 12:15:54 -0400, tedd.sperl...@gmail.com (tedd) wrote: At 3:56 PM +0200 10/6/09, Andrea Giammarchi wrote: Does these behaves exactly? for($i=0; $i10; ++$i) for($i=0; $i10; $i++) different benchmarks showed ++$i is usually faster than $i++ Faster is a relative term that

[PHP] Insult my code!

2009-10-07 Thread Eric Bauman
Hi there, I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to implement a super-tiny MVC framework. I've created some mockups of how the framework might be used based around a very simple 'bank', but I'm trying to get some feedback before I go and

[PHP] Output buffering

2009-10-07 Thread Arno Kuhl
Has there been a change to the way output buffering works? The manual states for ob_get_contents() This will return the contents of the output buffer or FALSE, if output buffering isn't active. But the following works in php4.4.4 and php5.2.6 whether output buffering is on or not ?php

RE: [PHP] Insult my code!

2009-10-07 Thread Mert Oztekin
Seems ok. Just a thought: Your model seems to be coded just for retreiving data. IMO you should code it for all possible actions(insert,update,delete,select). And also it should run without any database calls(you may create a new bank user in a page and use it than throw it away, so

Re: [PHP] Insult my code!

2009-10-07 Thread David Otton
2009/10/7 Eric Bauman baum...@livejournal.dk: Any thoughts would be much appreciated! One observation. Model isn't a synonym for Database Table - models can be anything that encapsulates business logic. Requiring all your models to inherit from Model is probably a bad idea. -- PHP General

Re: [PHP] Output buffering

2009-10-07 Thread David Otton
2009/10/7 Arno Kuhl ak...@telkomsa.net: According to the manual I shouldn't see anything at all when output_buffering is off (or if memory serves me correctly I should see an error about headers already sent or something). Looking at phpinfo confirms the value echoed by the script. Has

RE: [PHP] Output buffering

2009-10-07 Thread Arno Kuhl
From: djo...@gmail.com [mailto:djo...@gmail.com] On Behalf Of David Otton Sent: 07 October 2009 10:54 AM To: a...@dotcontent.net Cc: php-general@lists.php.net Subject: Re: [PHP] Output buffering 2009/10/7 Arno Kuhl ak...@telkomsa.net: According to the manual I shouldn't see anything at all when

[PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Hello all, I'm having this strange behavior, and I do not understanding why... When I use FILTER_VALIDATE_INT I'm unable to get, on my input box, values starting with 0(zero), or values that are greater (in length) then 10 digits. I was expecting to be able to input the all range of integers.

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ashley Sheridan
On Wed, 2009-10-07 at 10:57 +0100, MEM wrote: Hello all, I'm having this strange behavior, and I do not understanding why... When I use FILTER_VALIDATE_INT I'm unable to get, on my input box, values starting with 0(zero), or values that are greater (in length) then 10 digits. I was

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
[sic] Before your e-mail, I've considering the use of this: if (!is_numeric($telefone)) { $erros['numberofsomething'] = 'Error - only numbers please.'; } I meant this of course: if (!is_numeric($numberofsomething)) { $erros['numberofsomething'] = 'Error - only numbers please.'; }

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ashley Sheridan
On Wed, 2009-10-07 at 11:19 +0100, MEM wrote: Well, at a guess, if a number is 0, PHP see's that as equivalent to a false. In this case, shouldn't php ignore the 0 as false? Also, numbers over 10 digits may be going over the limit for your PHP install, assuming PHP actually

Re: [PHP] Insult my code!

2009-10-07 Thread Eric Bauman
On 7/10/2009 7:36 PM, Mert Oztekin wrote: Seems ok. Just a thought: Your model seems to be coded just for retreiving data. IMO you should code it for all possible actions(insert,update,delete,select). And also it should run without any database calls(you may create a new bank user

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Well, it was only a guess, but if you look at the integer limit on 32-bit systems, you'll see that the upper limit for numbers is 2147483647 (or 2^31-1) which would explain maybe your upper limit problem. Also, I think you're getting confused over the zero with exactly what you are

Re: [PHP] Insult my code!

2009-10-07 Thread Eric Bauman
On 7/10/2009 7:25 PM, David Otton wrote: 2009/10/7 Eric Baumanbaum...@livejournal.dk: Any thoughts would be much appreciated! One observation. Model isn't a synonym for Database Table - models can be anything that encapsulates business logic. Requiring all your models to inherit from Model

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread tedd
At 6:15 PM -0700 10/6/09, Daevid Vincent wrote: Except that: $a = 123; $b = $a++; echo $b; //gives 123, not 124 as you logically expect it to and common sense would dictate, regardless of what KR or anyone else says. That's not the way I look at it. $b = $a++; means to me take the

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Ashley Sheridan
On Wed, 2009-10-07 at 08:54 -0400, tedd wrote: At 6:15 PM -0700 10/6/09, Daevid Vincent wrote: Except that: $a = 123; $b = $a++; echo $b; //gives 123, not 124 as you logically expect it to and common sense would dictate, regardless of what KR or anyone else says. That's not the way

Re: [PHP] Output buffering

2009-10-07 Thread Shawn McKenzie
Arno Kuhl wrote: Thanks David. After taking another look at the description for ob_start() I began to suspect there was a difference, but the manual doesn't mention anything about it. And the fact they use the same terminolgy for both the settings and the functions is confusing. I can see

[PHP] problem with graphicsMagick and Apache

2009-10-07 Thread Toke Herkild
Hi All, Might not be the correct place, but I hope someone in here can help me with this problem. running this from command line will execute correctly: gm convert source -resize 600x800 dest but running the same from within a script using exec() causes the threads to hang, restarting

Re: [PHP] Insult my code!

2009-10-07 Thread Martin Scotta
On Wed, Oct 7, 2009 at 8:06 AM, Eric Bauman baum...@livejournal.dk wrote: On 7/10/2009 7:25 PM, David Otton wrote: 2009/10/7 Eric Baumanbaum...@livejournal.dk: Any thoughts would be much appreciated! One observation. Model isn't a synonym for Database Table - models can be anything that

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Jay Blanchard
Speaking of. [snip] -Original Message- From: Daevid Vincent [mailto:dae...@daevid.com] Sent: Tuesday, October 06, 2009 8:21 PM To: Jay Blanchard; 'Tommy Pham'; php-general@lists.php.net Subject: RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo HEY! Don't try to

RE: [PHP] Insult my code!

2009-10-07 Thread Andrea Giammarchi
So far I stopped at the first line, the constructor, where I can spot with what I can read SQL injections everywhere I hope here is a proper validation there, 'cause as is, sounds truly dangerous, since you are not using bindParams or other PDO related techniques to avoid input problems.

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Eddie Drapkin
On Tue, Oct 6, 2009 at 6:59 PM, Andrea Giammarchi an_...@hotmail.com wrote: So while we can debate computing considerations of today, tomorrow those will be less important. That was the point I was making. Why not focus on things that make significant difference and let the insignificant

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrea Giammarchi
I can write a test[1] that comes out with these results: String concat time: 0.18807196617126 String interpolation time: 0.14288902282715 Where using is faster than ' ! Common wisdom be damned! where is the test? ... and, is that kind of test where you put 12345678 variables inside a

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Tom Worster
just yesterday i was reading through this wonderful and very funny presentation: http://talks.php.net/show/froscon08/0 for me it really drove home the message (among others) that it makes sense to find out where the real gains can be made before investing your efforts in optimization. --

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrea Giammarchi
I don't get why for you code style means effort, waste of time ... I bloody write code, how do you write a loop? The same as I do ... except I put ++i rather than i++ ... does it change ANYTHING? For you no, for me yes ... whre is the drama here? I cannot spot it, it's like saying: I don't

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Eddie Drapkin
On Wed, Oct 7, 2009 at 11:36 AM, Tom Worster f...@thefsb.org wrote: just yesterday i was reading through this wonderful and very funny presentation:    http://talks.php.net/show/froscon08/0 for me it really drove home the message (among others) that it makes sense to find out where the real

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrea Giammarchi
This is a great talk / slideshow and definitely is a better way to drive home the point that PHP execution speed is relatively meaningless in terms of user experience. Well, at least up to a point... if it takes 0.1 per response, with 10 users will be 1 second to wait ... if it takes

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Jay Blanchard
[snip] ...flame... [/snip] Easy there hoss, no need to get worked up. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrea Giammarchi
Easy there hoss, no need to get worked up. In my opinion, being blamed for natural optimizations is the most ridiculous, hilarious, anti professional behavior I have ever seen ... but you are right, no need to get worked up, so have fun here. Regards

Re: [PHP] Insult my code!

2009-10-07 Thread Paul M Foster
On Wed, Oct 07, 2009 at 05:34:35PM +1100, Eric Bauman wrote: Hi there, I'm in the process of trying to wrap my head around MVC, and as part of that, I'm attempting to implement a super-tiny MVC framework. I've created some mockups of how the framework might be used based around a very

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
If I put 0 filter_var() will return false. Actually it returns the integer 0, not the boolean FALSE. Here's an illustration of the difference: http://codepad.org/73wff2u0 The integer value 0 can masquerade as false in an if() statement, of course, as Ash pointed out above. If I put 0342352

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
How is 0342352 being assigned to the variable that you're filtering? If PHP thinks it's a string, then the filter will fail. If PHP thinks it's a number, it seems to convert it internally to the number 115946, before you get to the filter.  Not sure what's going on there. At any Sorry, brain

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
How is 0342352 being assigned to the variable that you're filtering? If PHP thinks it's a string, then the filter will fail. If PHP thinks Oops, potentially bad information there as well, sorry. In general, a string representation of a decimal number /will/ pass FILTER_VALIDATE_INT. But your

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ashley Sheridan
On Wed, 2009-10-07 at 12:03 +0100, MEM wrote: Well, it was only a guess, but if you look at the integer limit on 32-bit systems, you'll see that the upper limit for numbers is 2147483647 (or 2^31-1) which would explain maybe your upper limit problem. Also, I think you're getting

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Tom Worster
On 10/7/09 6:04 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Wed, 2009-10-07 at 10:57 +0100, MEM wrote: Hello all, I'm having this strange behavior, and I do not understanding why... When I use FILTER_VALIDATE_INT I'm unable to get, on my input box, values starting with

RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread tedd
At 1:59 PM +0100 10/7/09, Ashley Sheridan wrote: On Wed, 2009-10-07 at 08:54 -0400, tedd wrote: At 6:15 PM -0700 10/6/09, Daevid Vincent wrote: Except that: $a = 123; $b = $a++; echo $b; //gives 123, not 124 as you logically expect it to and common sense would dictate, regardless of what KR

Re: [PHP] Output buffering

2009-10-07 Thread David Otton
2009/10/7 Arno Kuhl ak...@telkomsa.net: Thanks David. After taking another look at the description for ob_start() I began to suspect there was a difference, but the manual doesn't mention anything about it. And the fact they use the same terminolgy for both the settings and the functions is

[PHP] Apache Rewrite Issues

2009-10-07 Thread Russell Seymour
Morning, I am trying to make my URLs more search engine friendly and I have come up against a problem. I want the following URL: mysite.example.com/articles/Test Story to be proxied to mysite.example.com/index.php?m=articlest=Test%20Story I have the following rule in my Apache

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrew Ballard
On Wed, Oct 7, 2009 at 3:42 PM, tedd tedd.sperl...@gmail.com wrote: However, what I find wacky about all of this is: for($i=1; $i=10; $i++) { echo($i); } and for($i=1; $i=10; ++$i) { echo($i); } Do exactly the same thing. I would have expected the first to

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Andrew Ballard
On Wed, Oct 7, 2009 at 3:58 PM, Andrew Ballard aball...@gmail.com wrote: On Wed, Oct 7, 2009 at 3:42 PM, tedd tedd.sperl...@gmail.com wrote: However, what I find wacky about all of this is: for($i=1; $i=10; $i++) { echo($i); } and for($i=1; $i=10; ++$i) { echo($i);

Re: [PHP] Insult my code!

2009-10-07 Thread David Otton
2009/10/7 Eric Bauman baum...@livejournal.dk: On 7/10/2009 7:25 PM, David Otton wrote: 2009/10/7 Eric Baumanbaum...@livejournal.dk: Any thoughts would be much appreciated! One observation. Model isn't a synonym for Database Table - models can be anything that encapsulates business logic.

Re: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo

2009-10-07 Thread Tommy Pham
From: tedd tedd.sperl...@gmail.com To: php-general@lists.php.net; a...@ashleysheridan.co.uk; Daevid Vincent dae...@daevid.com Sent: Wed, October 7, 2009 12:42:41 PM Subject: RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo At 1:59 PM +0100

Re: [PHP] Apache Rewrite Issues

2009-10-07 Thread Tommy Pham
- Original Message From: Russell Seymour russell.seym...@turtlesystems.co.uk To: php-general@lists.php.net Sent: Wed, October 7, 2009 3:52:00 AM Subject: [PHP] Apache Rewrite Issues Morning, I am trying to make my URLs more search engine friendly and I have come up against a

[PHP] Download Wrapper

2009-10-07 Thread Michael A. Peters
I'm using flowplay (flash) for embedded audio/video. Initially I was using html5 w/ flowplay as fall back, but I stopped because flowplay is better than html5 on browsers that support html5. Anyway - I also am making direct links to the media available as mp4/ogm and mp3/ogg. The problem is

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Ben Dunlap
Also, I think you're getting confused over the zero with exactly what you are asking PHP to do. filter_var() returns true if the filter matches. If the 0 match is returned as a false, then filter_var() will filter_var() actually returns the filtered data if the filter matches, and FALSE if it

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Well, at a guess, if a number is 0, PHP see's that as equivalent to a false. In this case, shouldn't php ignore the 0 as false? Also, numbers over 10 digits may be going over the limit for your PHP install, assuming PHP actually attempts to convert the string to a real integer for the

Re: [PHP] Apache Rewrite Issues

2009-10-07 Thread Paul M Foster
On Wed, Oct 07, 2009 at 11:52:00AM +0100, Russell Seymour wrote: Morning, I am trying to make my URLs more search engine friendly and I have come up against a problem. I want the following URL: mysite.example.com/articles/Test Story to be proxied to

Re: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread Martin Scotta
Are you using the == operator or === ? maybe that's the problem the function could return false or 0. You need to use the === operator if( false !== ( $value = filter_var($value, FILTER_VALIDATE_INT))) { echo 'I need an Integer'; exit; } echo 'Thanks for the Int'; On Wed, Oct 7, 2009 at 2:13

Re: [PHP] Insult my code!

2009-10-07 Thread Paul M Foster
On Wed, Oct 07, 2009 at 09:09:29PM +0100, David Otton wrote: 2009/10/7 Eric Bauman baum...@livejournal.dk: On 7/10/2009 7:25 PM, David Otton wrote: 2009/10/7 Eric Baumanbaum...@livejournal.dk: Any thoughts would be much appreciated! One observation. Model isn't a synonym for

[PHP] foreach insert error

2009-10-07 Thread Haig Davis
Hello All, I have spent the entire day trying to get my calendar app to function correctly --- I have no problem with the actual functioning of the calendar. What is giving me trouble is for each calendar day the user has the option to check a checkbox requesting the day off and additionally the

Re: [PHP] Insult my code!

2009-10-07 Thread David Otton
2009/10/7 Paul M Foster pa...@quillandmouse.com: I think this is a bit extreme. It really depends on what's in your parent model class. It could be something really simple, but something you don't want to have to rewrite in every model you code. Thinking that Have you got an example of

RE: [PHP] FILTER_VALIDATE_INT - newbie question

2009-10-07 Thread MEM
Thank you all for your replies. The issue was solved for a better fitting solution on this case, that was by using a regex expression. I've not tested the difference between using == or ===. I was using ! But, the main question that is not clear on my newbie head is, why how why couldn't this

Re: [PHP] foreach insert error

2009-10-07 Thread Jim Lucas
Haig Davis wrote: Hello All, I have spent the entire day trying to get my calendar app to function correctly --- I have no problem with the actual functioning of the calendar. What is giving me trouble is for each calendar day the user has the option to check a checkbox requesting the day

Re: [PHP] Insult my code!

2009-10-07 Thread Paul M Foster
On Wed, Oct 07, 2009 at 11:31:58PM +0100, David Otton wrote: 2009/10/7 Paul M Foster pa...@quillandmouse.com: I think this is a bit extreme. It really depends on what's in your parent model class. It could be something really simple, but something you don't want to have to rewrite in

Re: [PHP] foreach insert error

2009-10-07 Thread Paul M Foster
On Wed, Oct 07, 2009 at 03:31:14PM -0700, Haig Davis wrote: Hello All, I have spent the entire day trying to get my calendar app to function correctly --- I have no problem with the actual functioning of the calendar. What is giving me trouble is for each calendar day the user has the

[PHP] Downflow Booths for Sampling Dispensing Applications

2009-10-07 Thread Esco Biotech Pvt. Ltd.
Dear Sir, Esco announces the launch of its NEW range of Pharmacon Downflow Booths for Sampling and Dispensing applications. Downflow Booths provide containment by utilizing high velocity air to capture airborne dust particles. Downflow Booths are versatile devices that can ·