php-general Digest 23 May 2011 08:14:00 -0000 Issue 7324

2011-05-23 Thread php-general-digest-help
php-general Digest 23 May 2011 08:14:00 - Issue 7324 Topics (messages 313072 through 313087): Re: Script ID? 313072 by: tedd Re: Queries and Common Practices 313073 by: tedd 313074 by: Dotan Cohen Re: context when calling non static method of class in a static way

RE: [PHP] A Review Request

2011-05-23 Thread Ford, Mike
-Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: 22 May 2011 22:33 At 5:50 PM +0200 5/22/11, Nisse =?utf-8?Q?Engstr=C3=B6m?= wrote: On Sat, 21 May 2011 09:26:02 -0400, tedd wrote: The function strcmp() simply evaluates two strings and reports back -1, 0,

Re: [PHP] Closing Session (Revisited)

2011-05-23 Thread Pete Ford
On 22/05/11 06:46, Roger Riordan wrote: On Thu, 05 May 2011 08:28:53 -0400, sstap...@mnsi.net (Steve Staples) wrote: On Thu, 2011-05-05 at 21:41 +1000, Roger Riordan wrote: I have developed a common engine which I use for several different websites. I had been using PHP 5.2.? and IE6 (yes;

[PHP] Re: Date validation

2011-05-23 Thread Pete Ford
On 20/05/11 16:29, Geoff Lane wrote: On Friday, May 20, 2011, Peter Lind wrote: Try: $date = new DateTime($date_string_to_validate); echo $date-format('Y-m-d'); Many thanks. Unfortunately, as I mentioned in my OP, the DateTime class seems to be 'broken' for my purposes because it uses

[PHP] strcmp()?

2011-05-23 Thread tedd
At 8:13 AM + 5/23/11, Ford, Mike wrote: -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] On Sat, 21 May 2011 09:26:02 -0400, tedd wrote: The function strcmp() simply evaluates two strings and reports back -1, 0, or 1 depending upon their alphabetical

Re: [PHP] strcmp()?

2011-05-23 Thread Joshua Kehn
On May 23, 2011, at 8:00 AM, tedd wrote: At 8:13 AM + 5/23/11, Ford, Mike wrote: -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] On Sat, 21 May 2011 09:26:02 -0400, tedd wrote: The function strcmp() simply evaluates two strings and reports back -1, 0, or 1

[PHP] Re: Date validation

2011-05-23 Thread tedd
At 9:47 AM +0100 5/23/11, Pete Ford wrote: Finally, for some applications I have made an AJAX (javascript + PHP) implementation which provides feedback to the user as they type in the date field: every time a character is typed in the box, the backend is asked to parse it and then format it in

Re: [PHP] strcmp()?

2011-05-23 Thread tedd
Mike: That's interesting. Try the same comparisons here: http://www.webbytedd.com/lcc/citw229/string-compare.php For me they are 1, -1, and 1. Might that have something to do with the version of PHP running? -Josh -Josh: I've written this on two different servers. One is

Re: [PHP] strcmp()?

2011-05-23 Thread Joshua Kehn
On May 23, 2011, at 8:17 AM, tedd wrote: Mike: That's interesting. Try the same comparisons here: http://www.webbytedd.com/lcc/citw229/string-compare.php For me they are 1, -1, and 1. Might that have something to do with the version of PHP running? -Josh -Josh: I've

RE: [PHP] strcmp()?

2011-05-23 Thread Jay Blanchard
[snip][/snip] 5.2.9 yields -1, 0, 1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] strcmp()?

2011-05-23 Thread Ford, Mike
-Original Message- From: Joshua Kehn [mailto:josh.k...@gmail.com] Sent: 23 May 2011 13:04 On May 23, 2011, at 8:00 AM, tedd wrote: At 8:13 AM + 5/23/11, Ford, Mike wrote: echo strcmp('These are nearly equal', 'These are almost equal'), \n; echo strcmp('different',

Re: [PHP] strcmp()?

2011-05-23 Thread Richard Quadling
On 23 May 2011 13:24, Joshua Kehn josh.k...@gmail.com wrote: On May 23, 2011, at 8:17 AM, tedd wrote: Mike: That's interesting. Try the same comparisons here: http://www.webbytedd.com/lcc/citw229/string-compare.php For me they are 1, -1, and 1. Might that have something to do with the

Re: [PHP] strcmp()?

2011-05-23 Thread Alexey Bovanenko
I checked on php 5.2.4-2 (ubuntu5.12). It returns 1,-1,1 On Mon, May 23, 2011 at 4:00 PM, tedd t...@sperling.com wrote: At 8:13 AM + 5/23/11, Ford, Mike wrote: -Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] On Sat, 21 May 2011 09:26:02 -0400, tedd wrote:

Re: [PHP] context when calling non static method of class in a static way

2011-05-23 Thread Simon Hilz
ah i forgot e_all doesnt include e_strict. with error_reporting(-1 / E_ALL | E_STRICT) i see the errors. so i think i am right that the use of that special behavior of php is not a good idea. thank you guys! Am 23.05.2011 00:32, schrieb Richard Quadling: On 22 May 2011 22:44, Simon

Re: [PHP] Re: Date validation

2011-05-23 Thread Pete Ford
On 23/05/11 13:12, tedd wrote: At 9:47 AM +0100 5/23/11, Pete Ford wrote: Finally, for some applications I have made an AJAX (javascript + PHP) implementation which provides feedback to the user as they type in the date field: every time a character is typed in the box, the backend is asked to

[PHP] best practise accessing object's attributes from objects itself

2011-05-23 Thread Simon Hilz
hi, i was wondering if there is any best practise known how one should access the attributes of an object from the object itself. i mean, it is a good practise to write getters and setters for the attributes of an object to its interface. but is it common to modify the attributes from the

Re: [PHP] strcmp()?

2011-05-23 Thread Joshua Kehn
On May 23, 2011, at 9:28 AM, Alex Nikitin wrote: There is an interesting note in the comments for strcmp: Well, I am using PHP 4.0 and both strcmp and strcasecmp appear to be giving me very arbitrary and incomprehensible results. When I input strings, it appears that equal strings return

RE: [PHP] strcmp()?

2011-05-23 Thread tedd
At 1:06 PM + 5/23/11, Ford, Mike wrote: (Incidentally, tedd, your test script has the signs the wrong way round in the output; plus which they should be lt; gt; anyway; plus plus which, you are not applying htmlspecialchars() or whatever to your echoed user input, so values such as

Re: [PHP] strcmp()?

2011-05-23 Thread tedd
At 9:32 AM -0400 5/23/11, Joshua Kehn wrote: All this confusion makes me glad that I'm using === for equality checks instead of strcmp. -Josh -Josh: Yes, but what if you were sorting? I know you could use sort(), but there might be logic where a strcmp() would better solve the problem.

Re: [PHP] strcmp()?

2011-05-23 Thread Alex Nikitin
On Mon, May 23, 2011 at 9:32 AM, Joshua Kehn josh.k...@gmail.com wrote: On May 23, 2011, at 9:28 AM, Alex Nikitin wrote: There is an interesting note in the comments for strcmp: Well, I am using PHP 4.0 and both strcmp and strcasecmp appear to be giving me very arbitrary and

RE: [PHP] strcmp()?

2011-05-23 Thread Ford, Mike
-Original Message- From: tedd [mailto:tedd.sperl...@gmail.com] Sent: 23 May 2011 14:41 The which way the arrows point thing is because I'm dyslexic. While I know that a appears before b, it's difficult for me to think of 'a' being less than 'b' -- UNLESS -- I think in terms of

Re: [PHP] strcmp()?

2011-05-23 Thread Joshua Kehn
On May 23, 2011, at 9:45 AM, tedd wrote: At 9:32 AM -0400 5/23/11, Joshua Kehn wrote: All this confusion makes me glad that I'm using === for equality checks instead of strcmp. -Josh -Josh: Yes, but what if you were sorting? I know you could use sort(), but there might be logic

Re: [PHP] Re: Date validation

2011-05-23 Thread Tamara Temple
Isn't this typically why date selectors are used on the front end? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] strcmp()?

2011-05-23 Thread Joshua Kehn
On May 23, 2011, at 9:47 AM, Alex Nikitin wrote: It depends on what you need to check, josh :) If you wanted to say find an anagram, or do a search with some typo correction, strcmp can be many times more helpful then a ===, that said comparing 2 strings to be equal === works about 20%

Re: [PHP] Re: Date validation

2011-05-23 Thread Andrew Ballard
On Mon, May 23, 2011 at 9:55 AM, Tamara Temple tamouse.li...@gmail.com wrote: Isn't this typically why date selectors are used on the front end? Not really. Date selectors are intended to make data entry easier on the front end while allowing only valid date selections, but you can't really

[PHP] Contract Example

2011-05-23 Thread Floyd Resler
I landed my first big PHP contract (yeah!) and am need of a contract or agreement example. Does anyone have, or know of a good source for, contract/agreement examples? Thanks! Floyd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] strcmp()?

2011-05-23 Thread Richard Quadling
On 23 May 2011 14:28, Alex Nikitin niks...@gmail.com wrote: There is an interesting note in the comments for strcmp: Well, I am using PHP 4.0 and both strcmp and strcasecmp appear to be giving me very arbitrary and incomprehensible results. When I input strings, it appears that equal strings

[PHP] Re: Contract Example

2011-05-23 Thread Jonesy
On Mon, 23 May 2011 10:39:10 -0400, Floyd Resler wrote: I landed my first big PHP contract (yeah!) and am need of a contract or agreement example. Does anyone have, or know of a good source for, contract/agreement examples? Thanks! Floyd Enforceable in what country/province?

Re: [PHP] Re: Contract Example

2011-05-23 Thread Floyd Resler
On May 23, 2011, at 11:12 AM, Jonesy wrote: On Mon, 23 May 2011 10:39:10 -0400, Floyd Resler wrote: I landed my first big PHP contract (yeah!) and am need of a contract or agreement example. Does anyone have, or know of a good source for, contract/agreement examples? Thanks! Floyd

Re: [PHP] Contract Example

2011-05-23 Thread tedd
At 10:39 AM -0400 5/23/11, Floyd Resler wrote: I landed my first big PHP contract (yeah!) and am need of a contract or agreement example. Does anyone have, or know of a good source for, contract/agreement examples? Thanks! Floyd Floyd: Here's something you may want to read:

Re: [PHP] PHP Brainteasers 2011

2011-05-23 Thread Daniel Brown
On Fri, May 20, 2011 at 12:55, Marc Guay m...@jkcommunications.com wrote: I imagine this one's been done before, but maybe not in the same way I believe it was, but not quite the same, you're right. If at first you don't succeed, try, try again. Nice one, Marc. ?php  

[PHP] Posts that include bracket OT bracket

2011-05-23 Thread tedd
Hi gang: When did the list start rejecting subject lines that contain [OT]? Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Contract Example

2011-05-23 Thread Floyd Resler
On May 23, 2011, at 11:29 AM, tedd wrote: At 10:39 AM -0400 5/23/11, Floyd Resler wrote: I landed my first big PHP contract (yeah!) and am need of a contract or agreement example. Does anyone have, or know of a good source for, contract/agreement examples? Thanks! Floyd Floyd:

[PHP] htaccess question

2011-05-23 Thread Al
How can I prevent access to all files in a directory except one with an htaccess file. I've tried several approaches found with Googling; but, none seem to work. e.g., FilesMatch ^(makeScodeImg.php) Order Allow,Deny Deny from all /FilesMatch This seems to me as it should deny to all except

RE: [PHP] htaccess question

2011-05-23 Thread admin
First turn your ReWriteEngine On. This can be done in the particular folder to allow them access to only the one file. You need to understand the conditions of mod_rewrite read below. http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html OR you can just use the http://cooletips.de/htaccess/

Re: [PHP] Posts that include bracket OT bracket

2011-05-23 Thread Daniel Brown
On Mon, May 23, 2011 at 11:33, tedd tedd.sperl...@gmail.com wrote: Hi gang: When did the list start rejecting subject lines that contain [OT]? At least several years ago. It bounces back to say that off-topic mail isn't accepted, blah, blah, blah. -- /Daniel P. Brown Network

Re: [PHP] htaccess question

2011-05-23 Thread Alex Nikitin
On Mon, May 23, 2011 at 11:52 AM, Al n...@ridersite.org wrote: How can I prevent access to all files in a directory except one with an htaccess file. I've tried several approaches found with Googling; but, none seem to work. e.g., FilesMatch ^(makeScodeImg.php) Order Allow,Deny Deny from

Re: [PHP] PHP Brainteasers 2011

2011-05-23 Thread tedd
At 11:29 AM -0400 5/23/11, Daniel Brown wrote: On Fri, May 20, 2011 at 12:55, Marc Guay m...@jkcommunications.com wrote: I imagine this one's been done before, but maybe not in the same way I believe it was, but not quite the same, you're right. If at first you don't

RE: [PHP] Posts that include bracket OT bracket

2011-05-23 Thread Daevid Vincent
-Original Message- From: paras...@gmail.com [mailto:paras...@gmail.com] On Behalf Of Daniel Brown Sent: Monday, May 23, 2011 11:20 AM To: tedd Cc: php-general@lists.php.net Subject: Re: [PHP] Posts that include bracket OT bracket On Mon, May 23, 2011 at 11:33, tedd

Re: [PHP] best practise accessing object's attributes from objects itself

2011-05-23 Thread David Harkness
On Mon, May 23, 2011 at 6:29 AM, Simon Hilz simon.h...@gmx.de wrote: i was wondering if there is any best practise known how one should access the attributes of an object from the object itself. For most properties I use $this-property within the object because nine times out of ten no work

RE: [PHP] observer pattern

2011-05-23 Thread Daevid Vincent
-Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Friday, May 20, 2011 2:25 PM To: PHP Subject: Re: [PHP] observer pattern [whoops didn't hit reply-all] On Wed, May 18, 2011 at 5:18 AM, Ken Guest k...@linux.ie wrote: Lo, so, I'm wondering - how many

Re: [PHP] observer pattern

2011-05-23 Thread Eric Butera
On Mon, May 23, 2011 at 5:14 PM, Daevid Vincent dae...@daevid.com wrote: -Original Message- From: Eric Butera [mailto:eric.but...@gmail.com] Sent: Friday, May 20, 2011 2:25 PM To: PHP Subject: Re: [PHP] observer pattern [whoops didn't hit reply-all] On Wed, May 18, 2011 at 5:18