$url = new moodle_url('/course/view.php', array('id' => $courseid)); echo $url->out();
$url = new moodle_url($resource_url); echo $url->out();This code generates a URL to an external resource specified in the $resource_url variable. Package Library: The moodle_url function is a part of the core library of Moodle and does not require any additional package library.