Solved

stupid question

Posted on 2009-05-12
3
330 Views
Last Modified: 2012-05-06
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
Comment
Question by:paries
3 Comments
 
LVL 7

Assisted Solution

by:ycTIN
ycTIN earned 100 total points
ID: 24370828
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
 
LVL 39

Accepted Solution

by:
Roger Baklund earned 300 total points
ID: 24370911
I often do this with the ternary operator (?:), like this:
print "-->usingNewCssStuff[".($usingNewCssStuff?'true':'false')."]<BR>";

Open in new window

0
 
LVL 11

Assisted Solution

by:BrianMM
BrianMM earned 100 total points
ID: 24372568
Just a quick observation... if layout is a property of an object...  it should be accessed as;

$UserSiteInfo->layout       --- no $
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

937 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now