I want to replace some text such as , with a " or some random ASCII symbol. How do i replace a character with an ascii character, by specifying the ascii value ? Also, how can i replace a , with a line break throughout the text that a user has entered ? Thanks for the help in advance.
So you mean you want to replace the character 'A' with the character 'B', but you want to specify the ascii value of 'B' (66) to the replacement function? If so: $ascii = 66; // ascii representation of 'B' $str = str_replace('A', chr($ascii), 'This is A string'); // $str will now contain: 'This is B string' PHP: $input = 'field1,field2,field3'; $str = str_replace(',', "\n", $input); PHP: