Posted by Angelos on 06/02/05 13:23
hello there...
I would like to ask if there is any way of using variables which are outside
functions in the functions without passing them when I call the function...
Complicated eehh ?
I have that :
*****************************************************
if (isset($_GET['category']) && isset($_GET['id'])) {
switch ($_GET['category']) {
case 'news':
echo "<h4>".date('d M Y',strtotime($release_date))."</h4>";
echo "<h3>".$content_title."</h3>";
echo "</p>".$body;
break;
}
}
else echo $body;
************************************************
and I want to convert it into that Function :
*************************************************
function displayContent(){
if (isset($_GET['category']) && isset($_GET['id'])) {
switch ($_GET['category']) {
case 'news':
echo "<h4>".date('d M Y',strtotime($release_date))."</h4>";
echo "<h3>".$content_title."</h3>";
echo "</p>".$body;
break;
}
}
else echo $body;
}
*****************************************************
ANd the question is : DO I have to pass all the variables that I use in the
function when I call it ?
I don't want to set the variables inside the functions because they are used
by other functions as well
May I have your lights PLS ?
Navigation:
[Reply to this message]
|