Don't want variable within function parameter to be parsed

From: Date: Sat, 09 Dec 2000 23:41:45 +0000
Subject: Don't want variable within function parameter to be parsed
Groups: php.general 
Request: Send a blank email to php-general+get-29512@lists.php.net to get a copy of this message
For my question I am posting a simplified version of the actual code I have written. In the print_output function of the real class, an array is looped through to generate an HTML table containing data and hyperlinks containing query string that can be used to jump to detailed records. Everything works fine, except I want variables within parameters of the set_url() function to be passed without being translated into their corresponding value. In the example below, I want $user_id to be set *after* it is called in print_output(), not while it's used within a paramter of set_url(). As it stands the output is: "page.html?user_id=&" while I want it to be "page.html?user_id=104". I've tried a number of things to get it to work with no success. Any solutions? <?php class Output { function set_url( $url ) { $this->url = $url; } function print_output() { $user_id = 104; $html = $this->url; echo $html; } } $Output = new Output; $Output->set_url( "page.html?user_id=$user_id" ); $Output->print_output(); ?> -- Steven Werby {steven-lists@befriend.com}

« previous php.general (#29512) next »