Skip to content

Instantly share code, notes, and snippets.

@DawTaylor
Last active October 10, 2016 14:39
Show Gist options
  • Save DawTaylor/3ccf372692d425ea7ac0daf693ea0596 to your computer and use it in GitHub Desktop.
Save DawTaylor/3ccf372692d425ea7ac0daf693ea0596 to your computer and use it in GitHub Desktop.
PHP $_GET sample for a simple URL reversing
<?php
//Saves $_GET['url'] parameter to var
$reverseURL = $_GET['url'];
//Logs the reverse URL to page
echo "Reverse URL => " . $reverseURL . "<br />";
//Reverts the $reverseURL string and saves it to var
$regularURL = strrev($reverseURL);
//Logs the regular (unreversed) URL to page
echo "Regular URL => " . $regularURL . "<br />";
//You can save this file and use the built-in PHP server to test it, if desired.
//Just access it from a web server passing your reverse URL as url GET parameter.
//http://localhost:8080/get_sample.php?url=moc.elpmaxe//:ptth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment