[PHP] Re: is_a() against instanceof
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Eli schrieb: > - ($cls instanceof ClassName) *requires* from ClassName to be declared, > and generates a fatal error when ClassName is not declared. How about if (class_exists('ClassName') AND $cls instanceof ClassName) { ... } Regards, Christian Stadler -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCN5d09250Hcbf/3IRAjACAJ4nuKWyohEgv74Ycj/oXYn/7vWW7gCaAqm3 FV6CJd6Sz3+K4Ur4WlKRlcM= =K8j5 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: is_a() against instanceof
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jason Barnett schrieb: > Nice suggestion! But I wonder... would it perhaps be better to use the > && operator instead of the AND operator? That way in case you are > trying to do an assignment PHP won't bother to check instanceof if the > class_exists() fails. > > if (class_exists($class) && $cls instanceof $class) > { > > } mmh ... instanceof isn't listed at http://www.php.net/manual/en/language.operators.php#language.operators.precedence so I'm not 100% sure. But neither php -r "var_dump(class_exists('foobar') AND $a instanceof foobar);" nor php -r "var_dump(class_exists('foobar') AND ($a instanceof foobar));" triggered an error on the commandline. So I guess, both && and AND should work. Regards, Christian Stadler -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCPeVQ9250Hcbf/3IRAg6rAJ96A/iBzkDU1X3cCOFWo/waV1y3ywCfSbIF S4JU3lo66WnPw5y8q3qMVSU= =bRQK -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: setlocale and pt_BR problem on debian
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jonis Maurin CearĂ¡ schrieb: > Hi Hi Jonis, > I'm trying to use setlocale to setup my language to pt_BR for ue with > strftime but don't work. > > I've tryied: > pt_BR > pt_BR.ISO_8859-1 > portuguese.br > etc... > > > but don't work, i just get in english. Is pt_BR being listed, when you execute locale -a on the commandline? system('locale -a'); should do the trick, if you don't have shell access. Regards, Christian Stadler -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCRcyr9250Hcbf/3IRAnGtAJ4wK0vjx9pB5C8aw9ppYlZOCX6d3ACeN9MP R+Uwqo6hfR0VD/KLk7Hzhrg= =mYQD -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php