Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   print session variable (https://www.warriorforum.com/programming/332963-print-session-variable.html)

layouts4you 15th February 2011 05:41 PM

print session variable
 
I need a little help with how to print this session variable to screen

the password field is the one im trying to echo out.

Array (
Object (
[path] =>
Array (
[0] =>
Array (
[post] =>
Array (
[password] => 123456
)
)
)
)
)

ProfitableWebsites 15th February 2011 06:48 PM

Re: print session variable
 
Is there a particular piece of software you are using or is it custom coded?

From the code you posted, the password is in an object. You'll need to look through the code to see where the object was instantiated... something like:


PHP Code:

$ myObject = new ObjectName(); 


Then to view the variables (object properties) you can use syntax like:

PHP Code:

echo $ myObject->password; 

Depending on the way it's coded, it may not be that simple. But that's the basic paradigm for printing out object properties for troubleshooting. Personally, I use PHPed. It's usually easier to track down bugs that way.

HTH

tirupati 15th February 2011 10:59 PM

Re: print session variable
 
I think this syntax will work
Quote:

echo $ myObject->password;
If it is wrong let me know

Tim Brownlaw 16th February 2011 02:19 AM

Re: print session variable
 
It's an array of a multidimensional array object...(try typing that out quickly)

Once you get the object out of the array...
PHP Code:

echo $ myObject->path[0]['post']['password']; 

I have to ask... what is generating this?

nxtgencreative 16th February 2011 08:05 AM

Re: print session variable
 
clean output in the screen:

<pre>
<?php print_r($myobject->password); ?>
</pre>

voitenkos 18th March 2011 09:51 PM

Re: print session variable
 
or you can use var_dump($myobject->password) as well


All times are GMT -6. The time now is 12:49 AM.