Page 1 of 1

updating a String

Posted: Mon Feb 16, 2004 1:22 am
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

Posted: Mon Feb 16, 2004 12:33 pm
by AVATAr
check string functions in php manual (example: http://www.php.net/substr), and you will figure it out.