updating a String

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
drummo
Forum Newbie
Posts: 5
Joined: Wed Jan 21, 2004 5:44 am

updating a String

Post by drummo »

Hi,
I am wanting to know if anyone can help me with some code to change the mapped drive?
I have a variable "X:/Home Directory/Directory/........." and I need to change it to "H:/Home Directory/Directory/.......... "

Cruzado_Mainfrm helped me with:

<?php
$str1 = "X:/Home Directory/Directory/";
$str2 = $str1;
$str2{0} = 'H'; //if not, change $str2{0} to $str2{1}
?>

...but it seems I also need to drop the first directory, so to finish with a string "H:/Directory/..."

Thanks in advance
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

check string functions in php manual (example: http://www.php.net/substr), and you will figure it out.
Post Reply