In the following code I am getting error: Undefined variable: base_url on line 27 and Cannot access empty property on line 27.
I need to echo the parameter http://google.com passed in get_url() from render().
<?php
$smart_url = new smart();
$smart_url -> get_url('http://google.com');
echo $smart_url -> render();
/**
* Smart URL
*/
class smart {
private $base_url;
/**
*
* @param string $url
*/
public function get_url($url) {
$this -> $base_url = $url;
}
/**
* @return string $base_url
*/
public function render() {
return $this -> $base_url;
}
}
?>