[nycphp-talk] Parse error setting an array - why?
Christopher R. Merlo
cmerlo at turing.matcmp.ncc.edu
Fri May 30 15:31:19 EDT 2003
On 2003-05-30 11:52 -0400, soazine at pop.erols.com <soazine at pop.mail.rcn.net> wrote:
> Bottom Line: I am trying to detect if the user is using Javascript from a
> server-side perspective.
It seems like this will help you:
$browser = get_browser( );
if( $browser->javascript == 1 ) {
// JavaScript is enabled
} else {
// It's not
}
...because get_browser returns an *object*, not an *array*. Even
though the example in the get_browser documentation seems to suggest
that foreach will do what it looks like it should, there are some
caveats to be read in the documentation of foreach. And, anyway, you
don't care about the rest of the object; all you care about is that
one field.
However, I haven't done much at all with objects in PHP, so YMMV.
-c
--
cmerlo at turing.matcmp.ncc.edu http://turing.matcmp.ncc.edu/~cmerlo
A boss with no humor is like a job that's no fun.
More information about the talk
mailing list