i get a T_ECHO unexpected error . what is the right way of accomplishing the above task?
In order for you to catch any data from the function get_option you most return it from within the function itself:
<?php
function get_option($var){
return $var;
}
$num_posts = get_option($shortname.'_num_posts');
//outputs what ever was returned from the function
echo $num_posts;
?>
What you are trying to do? If you want print, the code is:
<?php
$somevariable = $anothervar;
?>
If you want to assign the value of the another var, the code is:
<?php
echo $anothervar;
$somevariable = $anothervar;
?>
It should just be
<?php $somevariable = $anothervar; ?>
I don't know what you are trying to do. echo
is a language construct, so returns nothing, so its return value cannot be assigned.
If you want to echo a value and assign it to another variable, it is best (most legible) to do it in two statements:
<?php
echo $anothervar;
$somevariable = $anothervar;
?>