Solved

stupid question

Posted on 2009-05-12
3
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

691 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