Topic awaiting preservation: striping url to be used as a $variable (Page 1 of 1) |
|
---|---|
Obsessive-Compulsive (I) Inmate From: |
posted 02-19-2005 00:04
Any ideas cause Im lost on this one: code: <?php
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 02-19-2005 01:09
You really need to be more specific about what you are trying to do. |
Paranoid (IV) Inmate From: France |
posted 02-19-2005 01:14
Hello and welcome in the Asylum, |
Bipolar (III) Inmate From: Minnesota |
posted 02-19-2005 15:09
You could also use code: $agent = basename($_SERVER['PHP_SELF']);
|
Bipolar (III) Inmate From: Australia |
posted 02-21-2005 01:09
The above methods are all well and good, but they dont leave much room for "automation". i.e having something flexible that could deal with many situations. code: //Get the site page
|
Paranoid (IV) Inmate From: France |
posted 02-21-2005 01:27
H][RO: isn't a code: echo preg_replace( "/(\d+)\.html/i", "\\1", basename( $_SERVER['REQUEST_URI'] ) ); not flexible enough code: function PARSE_MYURL( $oldString, $separator )
|
Bipolar (III) Inmate From: Australia |
posted 02-21-2005 01:39
Yeh there is a number of ways to do it, some more efficient too - depends on the string and what you are trying to do. Using a mix with preg replace is probably best. The exploding array would work well if you wanted to specify which segment to get also. |