Page 1 of 1

i want to change the 3 character in my string in php

Posted: Thu Dec 10, 2009 7:51 am
by lokesh_kumar_s
i want to change the third character in my string in php. the thing is i want to specify the location like three. i dont want to change character at any other position please help

Re: i want to change the 3 character in my string in php

Posted: Thu Dec 10, 2009 8:02 am
by yacahuma

Code: Select all

 
  $str = 'abcd';
  $str[2] = 'X';
  echo $str;
 

Re: i want to change the 3 character in my string in php

Posted: Thu Dec 10, 2009 8:06 am
by lokesh_kumar_s
yacahuma wrote:

Code: Select all

 
  $str = 'abcd';
  $str[2] = 'X';
  echo $str;
 
thanks a lot yacahuma.