depends on what you're trying to do specifically.
for one thing, if you always want to use the file "people.txt", and have the
contents of that file displayed anytime you call $content, then:

function output(){
    $file=file("people.txt");
    foreach($file as $value) {
        $mycontent.=$value."<br>";
    }
    return $mycontent;
}

$content=$output();

now $content will always output the content in people.txt.
so:

if($action=="people")
    echo $content;
else
    error();

Hope this helped.


"Labunski" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi, I need to convert the script below into the variable " $content ".
> How to do this?
> I need this because I want to have an output of this function anywhere
where
> the $content is.
>
>
> if ($action=="people"){
> function output() {
> $file = file("people.txt");
> foreach($file as $value ){
> print "$value<br>";}
> }
> output(); //maybe I don't need to have this line here, I'm not sure.
> }else{
> error ();
> }
>
> If you don't understand what I said, you can email me: [EMAIL PROTECTED]
>
> Thank you very much,
> sorry for my bad english,
> Roman

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to