• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

stupid question

I am doing some stuff in php.
I am a java guy, but the php has been going swimmingly

except i am stumped

    $usingNewCssStuff = false;
    if ( $UserSiteInfo->$layout > 0 ){
        $usingNewCssStuff = true;
    }
    print "-->usingNewCssStuff[".$usingNewCssStuff."]<BR>";

The print out is always []

can someone please explain.

It has to bee something stupid

thanks

0
paries
Asked:
paries
3 Solutions
 
ycTINCommented:
boolean variable is invisible in html

you need some function to convert it

e.g.
var_export()
var_dump()

<?php
    $usingNewCssStuff = false;
    if ( $UserSiteInfo->$layout > 0 ){
        $usingNewCssStuff = true;
    }
    print "-->usingNewCssStuff[".var_export($usingNewCssStuff,true)."]<BR>";
?>

Open in new window

0
 
Roger BaklundCommented:
I often do this with the ternary operator (?:), like this:
print "-->usingNewCssStuff[".($usingNewCssStuff?'true':'false')."]<BR>";

Open in new window

0
 
BrianMMCommented:
Just a quick observation... if layout is a property of an object...  it should be accessed as;

$UserSiteInfo->layout       --- no $
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now