Bman900 Posted June 27, 2009 Share Posted June 27, 2009 I have this in php4: <?php $root = $_SERVER['SERVER_NAME']; $url = $_SERVER['PATH_INFO']; $adminregister = str_replace("admin/admin.php","register.php",$url); echo "http://www.$root$adminregister"; ?> How can this be rewritten to work in PHP5? Link to comment https://forums.phpfreaks.com/topic/163887-another-way-to-write-this/ Share on other sites More sharing options...
MasterACE14 Posted June 27, 2009 Share Posted June 27, 2009 looks right, could just clean up the echo alittle. <?php $root = $_SERVER['SERVER_NAME']; $url = $_SERVER['PATH_INFO']; $adminregister = str_replace("admin/admin.php","register.php",$url); echo "http://www.".$root.$adminregister; ?> Link to comment https://forums.phpfreaks.com/topic/163887-another-way-to-write-this/#findComment-864680 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.