Jump to content

Replace text using php


leachus2002

Recommended Posts

Hi There,

 

I am developing an internal web page on our intranet - and I am using the $_SERVER['REMOTE_USER'] varible to pass through who is logged on to a particular web page. Unfortunaetly, if I echo this on to the screen, it displays "domainname/username" - is there any way that I can remove the "domainname/" from the start of the string so that it just echo's "username"?

 

Help appreciated

 

Thanks

Matt

Link to comment
https://forums.phpfreaks.com/topic/199367-replace-text-using-php/
Share on other sites

Thanks for coming back to me, however, I think I am getting confused:

 

Where I am using the "$_SERVER['REMOTE_USER']" varible, would i have to code the following:

 

$result = "
$_SERVER['REMOTE_USER']";
$username = explode("/", $result);
print $username[1];

 

Because the user will always be different

 

Thanks

 

Matt

Sorry to be a pain - but is there any way I can get that print line in to a varible? I have tried $user = print username[1]; echo $user - but that will echo username1

 

Thanks

Matt

 

You'd need to do echo $username[1]. Echo and print are pretty much the same thing.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.