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

2011-05-22 Thread Richard Quadling
On 22 May 2011 22:44, Simon Hilz wrote: > i cant reproduce that error. which php version do you use? > i've coded an example for a "behavior"-pattern: > Try with ... call TankUpBehavior::tankUp (100) Strict Standards: Non-static method TankUpBehavior::tankUp() should not be called statically, as

Re: [PHP] A Review Request

2011-05-22 Thread tedd
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, or 1 depending upon their alphabetical relationship. It might do that, but don't bet your horse on it.

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

2011-05-22 Thread Simon Hilz
i cant reproduce that error. which php version do you use? i've coded an example for a "behavior"-pattern: = error_reporting(E_ALL & E_STRICT); class Car { private $fuel = 0; private $drivenDistance = 0; private $consumption =

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

2011-05-22 Thread Peter Lind
class A { public function b() { echo get_class($this); } static function c() { echo get_class($this); } } class B { public function test(){ A::b(); A::c(); } } $b = new B; $b->test(); Generates: Strict Standards: Non-static method A::b() sho

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

2011-05-22 Thread Simon Hilz
the good thing about this "bug" would be, that it's not neccesary to extend a class to use its methods as if they would be defined in the extending class. this way i think it would be possible to implement something like multiple inheritance, which is currently not (that easy) possible. when i'

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

2011-05-22 Thread admin
Correct that. I do not know what I was even thinking when I wrote that response. It does not make any sense what so ever. The class is already extended of course I can call a method from it. Sorry Richard L. Buskirk -Original Message- From: Simon Hilz [mailto:simon.h...@gmx.de] Sen

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

2011-05-22 Thread admin
Simon, To be honest if it works, I hope they do not fix it. My only problem is that my classes are typically not in the same file but they are extended. I am going to try that on an extended class and see if I can instantiate a method from another class in a separate file. Richard L. Bus

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

2011-05-22 Thread Simon Hilz
Mike, yes i know the difference. I actually discovered that by accident when i've forgot to write the static keyword. my code lead to an exception. i wondered about the details of that exception and came to the solution that the behavior as decribed exists. in my opinion one could really use

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

2011-05-22 Thread Simon Hilz
Richard, yes! at least my example works. i didn't test it any further; i doubt it is intended that way. Simon Hilz Am 22.05.2011 16:42, schrieb ad...@buskirkgraphics.com: Simon, So without extending foo you can run bar in another class? Richard L. Buskirk -Original Message---

Re: [PHP] A Review Request

2011-05-22 Thread Nisse Engström
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 relationship. It might do that, but don't bet your horse on it. /Nisse --

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

2011-05-22 Thread admin
Simon, So without extending foo you can run bar in another class? Richard L. Buskirk -Original Message- From: Simon Hilz [mailto:simon.h...@gmx.de] Sent: Sunday, May 22, 2011 10:18 AM To: php-general@lists.php.net Subject: [PHP] context when calling non static method of class i

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

2011-05-22 Thread Mike Mackintosh
Simon, You may want to be careful with the way you declare your class methods. Example: public function bar() != static function bar(), even if you use pnysudsfksdljfasdjfsd (::) See the example below. class Foo{ static function barStatic() { echo get_class($this); }

Re: [PHP] Queries and Common Practices

2011-05-22 Thread Dotan Cohen
On Sun, May 22, 2011 at 17:38, tedd wrote: > SELECT p.id, p.name, a.total FROM people p, accounts.a WHERE gender = 'male' > Finding the error in the above code is fun. I'm surprised I spotted, it shows how sensitive one gets to debugging. For that matter, I like the OP's practice of redundancy i

Re: [PHP] Queries and Common Practices

2011-05-22 Thread tedd
At 10:50 AM +0100 5/22/11, Ashley Sheridan wrote: -snip- but I also give the table a moniker which lets me shorten the queries as I type: SELECT p.id, p.name FROM people p WHERE p.gender = 'male' This way, I can easily join in other tables, my typing is kept to a minimum as I do it also. A

Re: [PHP] Script ID?

2011-05-22 Thread tedd
At 1:47 PM -0400 5/21/11, Adam Richardson wrote: On Sat, May 21, 2011 at 10:11 AM, tedd <t...@sperling.com> wrote: Hi gang: Okay, so,what's the "best" (i.e., most secure) way for your script to identify itself *IF* you plan on using that information later, such as t

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

2011-05-22 Thread Simon Hilz
hi, lets assume the following classes: class Foo{ public function bar() { echo get_class($this); } } class Foobar{ public function callBarStatic() { Foo::bar(); } } the following code results in the output "Foobar": $obj = new Foobar(); $obj

Re: [PHP] Queries and Common Practices

2011-05-22 Thread Richard Quadling
On 22 May 2011 10:50, Ashley Sheridan wrote: > On Sun, 2011-05-22 at 05:33 -0400, ad...@buskirkgraphics.com wrote: > >> I have been working on a class methods for some time now. >> >> >> >> I have reached a cross road when it comes to common practice of developing >> query structure. >> >> >> >> L

Re: [PHP] Queries and Common Practices

2011-05-22 Thread Ashley Sheridan
On Sun, 2011-05-22 at 05:33 -0400, ad...@buskirkgraphics.com wrote: > I have been working on a class methods for some time now. > > > > I have reached a cross road when it comes to common practice of developing > query structure. > > > > Long ago I wrote queries where I just called the fi

[PHP] Queries and Common Practices

2011-05-22 Thread admin
I have been working on a class methods for some time now. I have reached a cross road when it comes to common practice of developing query structure. Long ago I wrote queries where I just called the field I wanted on a particular table unless I was joining them. Example: $query = " SE

Re: [PHP] Check the byte sequence of a file to tell if it is UTF-8 without the BOM using PHP ?

2011-05-22 Thread Eli Orr (Office)
Thank you Peter. Can you please advise if mb_detect_encodin does detect the file type by its structure / content? Thanks Eli On 22/05/2011 10:12, Peter Lind wrote: On 22 May 2011 09:03, Eli Orr (Office) wrote: Dear Peter, But my point was different. If you DO NOT have any BOM of a Fi

Re: [PHP] Check the byte sequence of a file to tell if it is UTF-8 without the BOM using PHP ?

2011-05-22 Thread Peter Lind
On 22 May 2011 09:03, Eli Orr (Office) wrote: > Dear Peter, > > But my point was different. > > If you DO NOT have any BOM of a File does > > mb_detect_encodin > > can detect the file type by scanning the whole file ?? > A few points: 1. top-posting on this list is frowned upon. Please bottom-pos

Re: [PHP] Check the byte sequence of a file to tell if it is UTF-8 without the BOM using PHP ?

2011-05-22 Thread Eli Orr (Office)
Dear Peter, But my point was different. If you DO NOT have any BOM of a File does mb_detect_encodin can detect the file type by scanning the whole file ?? Thanks Eli On 22/05/2011 09:53, Peter Lind wrote: On 22 May 2011 08:17, Eli Orr (Office) wrote: Hi Adam, I have a prof that the XML