How about a brief introduction to using php.net?
1. How do I pull the URL of the current page and set it as a variable?
$whatever = ??
Step 1) consider what you're looking for. I see three likely key words here - variable, URL and script. So let's go to http://www.php.net/manual/en and see what these turn up.
I clicked on variables and then predefined variables and I got this page.
http://www.php.net/manual/en/language.variables.predefined.php
I want server information (i.e. the url of the script) so I clicked on $_SERVER.
I found some interesting stuff here:
HTTP_HOST, PHP_SELF and QUERY_STRING looks like I could do this
$my_url = $SERVER['HTTP_HOST'] . $SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
2. How do I take only a certain few characters from a variable? In Actionscript it's called 'slice'.
longvariable.slice(0,3) = short variable, so I'll only get the first four characters in a variable.
The general computer science terminology for a slice is called a subscring. Search for that on php.net and see what turns up.