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? Quote 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; ?> Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.