[PHP] A really wacky design decision

2009-10-03 Thread clancy_1
Daevid Vincent is surprised that: $num = 123; $num = $num++; print $num; //this prints 123 and not 124 ?!! To me this is relatively logical. As I understand it, the post-increment operator says do something with the variable, and then increment it. The trouble in this case is that we are

[PHP] Header problem

2009-10-03 Thread Kim Madsen
Hi PHP people I have a really strange and annoying problem. I've got a site, where members can download music. User clicks index.php (in index.php there's an iframe, that opens another file), if certain check are okay then a popup window opens download.php, where a mp3 file is fetched from the

RE: [PHP] A really wacky design decision

2009-10-03 Thread Andrea Giammarchi
And then you discover === $i = 0; $j = count ($names); while ($i $j) { if ($names[$i] === $target) { break; } ++$i; } ... regards To: php-general@lists.php.net From: clanc...@cybec.com.au Date: Sat, 3 Oct 2009 21:21:00 +1000 Subject: [PHP] A really wacky design decision Daevid

RE: [PHP] Header problem

2009-10-03 Thread Andrea Giammarchi
Do you want users download the file or the zip? do you send other headers before the download? It's quite a common error to set a default header in PHP at the beginning of whatever application, while header should be used as last exit point and never in the middle, or at the beginning, of a

[PHP] Problem with Filesystem Functions

2009-10-03 Thread Andrew Burgess
I hope this isn't too basic of a question . . . I'm having a problem with the Filesystem Functions, I think. Specifically, I'm recursing through a directory, and have this code: $size = filesize($file); $type = filetype($file); $date = filemtime($file); I'm getting these warnings: Warning:

Re: [PHP] Problem with Filesystem Functions

2009-10-03 Thread Ashley Sheridan
On Sat, 2009-10-03 at 09:07 -0400, Andrew Burgess wrote: I hope this isn't too basic of a question . . . I'm having a problem with the Filesystem Functions, I think. Specifically, I'm recursing through a directory, and have this code: $size = filesize($file); $type = filetype($file);

[PHP] Re: A really wacky design decision

2009-10-03 Thread Ralph Deffke
u increment after! asigning, so far so good, but for math reasons the interpreter has to keep in mind the 123 you want to assign before increment to the same var. this is absolutely correct what php does here. $num = ++$num; would print 124 the same like $num++; on the other hand this is just

Re: [PHP] Self-Process php forms or not?

2009-10-03 Thread Tom Worster
On 10/2/09 10:24 AM, tedd tedd.sperl...@gmail.com wrote: At 1:55 PM +0530 10/2/09, kranthi wrote: and yes i forgot to mention... i avoid hidden form elements because they can be modified very easily and hence pose a security threat. That depends upon how sloppy you are in coding. NONE of

Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Ashley Sheridan
On Sat, 2009-10-03 at 15:33 +0200, Ralph Deffke wrote: u increment after! asigning, so far so good, but for math reasons the interpreter has to keep in mind the 123 you want to assign before increment to the same var. this is absolutely correct what php does here. $num = ++$num; would

Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Ralph Deffke
yes for using $num = $num++; yes !! Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1254577641.2385.7.ca...@localhost... On Sat, 2009-10-03 at 15:33 +0200, Ralph Deffke wrote: u increment after! asigning, so far so good, but for math reasons the interpreter has to keep in

Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Ashley Sheridan
On Sat, 2009-10-03 at 15:46 +0200, Ralph Deffke wrote: yes for using $num = $num++; yes !! Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1254577641.2385.7.ca...@localhost... On Sat, 2009-10-03 at 15:33 +0200, Ralph Deffke wrote: u increment after! asigning, so

Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Ralph Deffke
this is a clear sign that somebody is on a sin TRAIL, I would not even spend the time on what sin collections this guy got Ashley Sheridan a...@ashleysheridan.co.uk wrote in message news:1254577986.2385.8.ca...@localhost... On Sat, 2009-10-03 at 15:46 +0200, Ralph Deffke wrote: yes for using

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

2009-10-03 Thread Ralph Deffke
Ben, might be intersting to consider that in ur c axample u r working with a pure memory position, while php works with references. thry it with pointers it I'm pretty shure u get the same result as in PHP. I'm not shure, because I don't work in perl, but doesn't per work on references as well ?

RE: [PHP] Self-Process php forms or not?

2009-10-03 Thread tedd
At 7:11 PM +0100 10/2/09, MEM wrote: I don't want to take another path. The hidden fields seems the way to go. However, you gave me the example above, and I'm not understanding how can I pass from your example: A multi-step form. To what I was looking form: 1 step form with a success page that

Re: [PHP] Self-Process php forms or not?

2009-10-03 Thread tedd
At 9:42 AM -0400 10/3/09, Tom Worster wrote: On 10/2/09 10:24 AM, tedd tedd.sperl...@gmail.com wrote: At 1:55 PM +0530 10/2/09, kranthi wrote: and yes i forgot to mention... i avoid hidden form elements because they can be modified very easily and hence pose a security threat. That

Re: [PHP] Header problem

2009-10-03 Thread kranthi
Thats a lot of headers to read.. At a first glance I can see that you did not specify a content-length header. this is a must and must be equal to the size of the file in bytes -- Kranthi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] A really wacky design decision

2009-10-03 Thread tedd
At 9:21 PM +1000 10/3/09, clanc...@cybec.com.au wrote: Daevid Vincent is surprised that: $num = 123; $num = $num++; print $num; //this prints 123 and not 124 ?!! I can understand why someone might think this is not correct, but they need to understand what is happening and why the above

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

2009-10-03 Thread tedd
At 2:01 PM -0700 10/2/09, Daevid Vincent wrote: Why would you EVER want $num = $num++; to give you back the value you already had? Even if we did $foo = $bar++; I would still logically (and common sensely) expect $foo to be the increment of $bar! You are right -- one should never structure a

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

2009-10-03 Thread tedd
At 5:12 PM -0400 10/2/09, Robert Cummings wrote: Daevid Vincent wrote: ?PHP $num = 123; $num = $num++; print $num; //this prints 123 and not 124 ?!! $num = 123; $num = ++$num; print $num; //this prints 124 as expected $num = 123; $num++; print $num; //this prints 124 as expected $num =

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

2009-10-03 Thread tedd
At 2:28 PM -0700 10/2/09, Daevid Vincent wrote: My problem isn't with $foo++ vs ++$foo per say. I use pre/post all the time. My issue is that I see no reason to do the ASSIGNMENT FIRST and THEN INCREMENT. I see your point exactly. The problem is with the statement of: $num = $num++; That

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

2009-10-03 Thread tedd
At 2:53 PM -0700 10/2/09, Ben Dunlap wrote: $a = 2; $a = $a++; echo $a; Honestly I think the only reason anyone would write an expression like that is either to fake out the compiler or because they don't properly understand the use of a unary operator. Or rather, of the

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

2009-10-03 Thread tedd
At 5:42 PM -0400 10/2/09, Daniel Brown wrote: If you were to use $num++, it would echo out the current number, THEN increment the value. In this example, it increments the value, THEN echoes it out. The placement of the signs (plus or minus) is the giveaway: if it's before the variable,

Re: [PHP] Problem with Filesystem Functions

2009-10-03 Thread Andrew Burgess
On Sat, Oct 3, 2009 at 9:29 AM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2009-10-03 at 09:07 -0400, Andrew Burgess wrote: I hope this isn't too basic of a question . . . I'm having a problem with the Filesystem Functions, I think. Specifically, I'm recursing through a

Re: [PHP] Self-Process php forms or not?

2009-10-03 Thread Tom Worster
On 10/2/09 10:06 AM, MEM tal...@gmail.com wrote: I'm now understanding that even if the form is submitted to self, we can still use a redirect to a success_message_page.php. However, we must do this redirect, AFTER the form has submitted to himself. It's the only thing that we have to pay

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

2009-10-03 Thread Daniel Brown
On Sat, Oct 3, 2009 at 10:49, tedd tedd.sperl...@gmail.com wrote: That's absolutely true. The problem here is in the statement of: $num = $num++; Yeah, I understood Daevid's email a bit better *after* I sent mine. Then I was hoping no one noticed. -- /Daniel P. Brown

Re: [PHP] Re: A really wacky design decision

2009-10-03 Thread Tom Worster
On 10/3/09 9:53 AM, Ralph Deffke ralph_def...@yahoo.de wrote: this is a clear sign that somebody is on a sin TRAIL, I would not even spend the time on what sin collections this guy got i see it more as ignorance than sin. to misunderstand the difference between $n++ and ++$n is a beginner

Re: [PHP] A really wacky design decision

2009-10-03 Thread Tom Worster
On 10/3/09 7:21 AM, clanc...@cybec.com.au clanc...@cybec.com.au wrote: However there is one feature of PHP which, to my mind, is really bad design. How many of you can see anything wrong with the following procedure to search a list of names for a particular name? $i = 0; $j = count

Re: [PHP] A really wacky design decision

2009-10-03 Thread Ashley Sheridan
On Sat, 2009-10-03 at 11:57 -0400, Tom Worster wrote: On 10/3/09 7:21 AM, clanc...@cybec.com.au clanc...@cybec.com.au wrote: However there is one feature of PHP which, to my mind, is really bad design. How many of you can see anything wrong with the following procedure to search a list

Re: [PHP] A really wacky design decision

2009-10-03 Thread Robert Cummings
tedd wrote: At 9:21 PM +1000 10/3/09, clanc...@cybec.com.au wrote: Daevid Vincent is surprised that: $num = 123; $num = $num++; print $num; //this prints 123 and not 124 ?!! I can understand why someone might think this is not correct, but they need to understand what is happening and

Re: [PHP] A really wacky design decision

2009-10-03 Thread Tom Worster
On 10/3/09 12:25 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2009-10-03 at 11:57 -0400, Tom Worster wrote: On 10/3/09 7:21 AM, clanc...@cybec.com.au clanc...@cybec.com.au wrote: However there is one feature of PHP which, to my mind, is really bad design. How many of you

Re: [PHP] A really wacky design decision

2009-10-03 Thread Robert Cummings
Tom Worster wrote: On 10/3/09 12:25 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Sat, 2009-10-03 at 11:57 -0400, Tom Worster wrote: On 10/3/09 7:21 AM, clanc...@cybec.com.au clanc...@cybec.com.au wrote: However there is one feature of PHP which, to my mind, is really bad design.

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

2009-10-03 Thread Andrea Giammarchi
... and, in fact, that /is/ how C behaves. The following code: int a = 2; a = a++; printf(a = [%d]\n, a); Will output a = [3]. At least on Ubuntu 9 using gcc 4.3.3. So I retract my initial terse reply and apologize for misunderstanding your question. Ben It's not that difficult

[PHP] problem with mod_php

2009-10-03 Thread JC
I'm trying to install a webmail in a new server with the following items: Debian 2.6.26-2-amd64 horde 3.2.2 imp 4.2.4 apache 2.2.9 php 5.2.6 when I try to install for the first time to configure it by web, it show the following: Internal Server Error The server encountered an internal error or

RE: [PHP] A really wacky design decision

2009-10-03 Thread Andrea Giammarchi
if we compare via == there is an implicit cast to the most primitive form. These are all true, and all have a reason, and make sense: // (int)'abc' is 0 var_dump('abc' == 0); // 'abc' is not an empty string var_dump('abc' == true); // 2 is not 0, which would be casted into false, so it's true

Re: [PHP] A really wacky design decision

2009-10-03 Thread Robert Cummings
Andrea Giammarchi wrote: If you use APD or you think about the low level logic behind comparing string, num and bool you'll probably forget the == operator and you'll never miss again the === one ... then you'll start to explicit cast everything, when necessary, to have all your code truly

RE: [PHP] A really wacky design decision

2009-10-03 Thread Andrea Giammarchi
You introduced the word suddenly, it's about 10 years I develop in PHP Regards PHP allows you to do either. If I find myself being more strict in no way does that mean I'll suddenly jump to another language. It just means I have a bit of code that requires a bit more strictness. Should I

Re: [PHP] A really wacky design decision

2009-10-03 Thread tedd
At 1:37 PM -0400 10/3/09, Robert Cummings wrote: tedd wrote: At 9:21 PM +1000 10/3/09, clanc...@cybec.com.au wrote: Daevid Vincent is surprised that: $num = 123; $num = $num++; print $num; //this prints 123 and not 124 ?!! I can understand why someone might think this is not correct, but

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

2009-10-03 Thread Lupus Michaelis
Ben Dunlap wrote: ... and, in fact, that /is/ how C behaves. The following code: No, that's implementation's behaviour. AFAIK, the normative document give to compiler the behaviour implementation. So, it can do optimization, that gives strange behaviour for a people how think increment

[PHP] Missing php5apache2.dll

2009-10-03 Thread Floydian
Hello, I've downloaded the VC6 PHP 5.3.0 windows zip (php-5.3.0-nts-Win32-VC6-x86.zip) and I don't see the file php5apache2.dll in it. php5apache.dll is in there, but the apache 2 file isn't. Where can I find this file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

[PHP] [SOLVED] Re: Missing php5apache2.dll

2009-10-03 Thread Floydian
Floydian wrote: Hello, I've downloaded the VC6 PHP 5.3.0 windows zip (php-5.3.0-nts-Win32-VC6-x86.zip) and I don't see the file php5apache2.dll in it. php5apache.dll is in there, but the apache 2 file isn't. Where can I find this file? I've found the dll :) The php5apache2.dll and

Re: [PHP] windows 5.2.10 PHP not working with phpinfo

2009-10-03 Thread Fred Silsbee
--- On Mon, 8/31/09, hack988 hack988 hack...@dev.htwap.com wrote: From: hack988 hack988 hack...@dev.htwap.com Subject: Re: [PHP] windows 5.2.10 PHP not working with phpinfo To: Fred Silsbee fredsils...@yahoo.com Cc: php-general@lists.php.net Date: Monday, August 31, 2009, 6:35 AM Please