Concise tutorials on PHP, Wordpress, and other matters related to web development

PHP Example:

function get_webpage_url() { return 'http' . ($_SERVER['SERVER_PORT'] == 443 ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; } // End of get_webpage_url() function. echo get_webpage_url();

JavaScript Example:

var get_webpage_url = function() { return window.location.href; }; // End of get_webpage_url() function. alert(get_webpage_url());
Result: https://codesnatches.com/