tags:

views:

57

answers:

2

how to get the value 4500 to a variable

stdClass Object ( [total] => 4500 ) 

i tried like these

$abc['total']
$abc->total 

when i print the $abc->total

i got

Array ( [0] => stdClass Object ( [total] => 4500 ) )

please help me

A: 
echo $abc->total

should work.

If you want to output the value in a string, enclose it in curly brackets to be on the safe side:

echo "Value is {$abc->total}";

or use string concatenation:

echo 'Value is ' . $abc->total;
Felix Kling
A: 

since you are not giving a large part of the PHP code i assume that code is correctly printed out

this answer works fine:

<?php
$abc = array('total' => 4500); // I've created an array with key='total' and val=4500
$abc = (object)$abc; // returns stdClass Object ( [total] => 4500 ) 
echo $abc->total; // it should print 4500
?>
Mihai Iorga
but i got error likeMessage: Undefined property: stdClass::$total
hwd
thankyou sir....
hwd