Forum Moderators: coopster

Message Too Old, No Replies

get value function

         

gonny

5:04 pm on Oct 6, 2008 (gmt 0)

10+ Year Member



Hi all!

I want to get a value in function:

Like $Skin->block($title, $main);

Now I want to retrive the first value $title.
Can be like this:

$value = $Skin->block($title, $main);
$val = $value[1]; ?

Any idea?

eelixduppy

5:06 pm on Oct 6, 2008 (gmt 0)



In your example, the method "block" would have to return an array where the array elements are its arguments. Also, for your example, I don't see why you won't just use $title since it is obviously in the scope you want to use it in. Any reason why you don't want that?

gonny

5:29 pm on Oct 6, 2008 (gmt 0)

10+ Year Member



I dont know but doesn't work

gonny

7:11 pm on Oct 6, 2008 (gmt 0)

10+ Year Member



ok I explain again.

I have some functions:

function func1($bla, $blabla) {
return <<<EOF
html ecc... $bla <br> $blabla
EOF;
}

function func2($title, $main) {
return <<<EOF
html ect... $title <br>$main
EOF;
}

Now I want to show $title in func1. But how?

eelixduppy

7:23 pm on Oct 6, 2008 (gmt 0)



Take a look at the variable scope documentation [us.php.net]. You're going to need to use global variables.