preg_replace and possible json issues
Posted: Wed Jun 11, 2014 2:55 am
I need to replace a whitespace at the beginning of any newline. I am using JSON to send over the POST values and suspect this may have something to do with it not working.
Running this, works as expected. When I attempt to use it with my JSON POST array, the whitespaces remain.
Does JSON play a part in this?
Code: Select all
$str='
This is a string.
This should be left justified by removing whitespaces preceding it.
';
preg_replace('/^\s+/', '', $str);Does JSON play a part in this?