Re: Re: replacing a null value using str_replace
| From: | Dan Hardiker | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Re: replacing a null value using str_replace | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96548@lists.php.net to get a copy of this message | ||
>> I was attempting to replace null values in an array with 0 using
>> str_replace, but was unsuccessful. The values in question were coming
>> from a MySQL query which returned an empty set.
If your using string replace functions, then use chr(0) - which is the null
byte.
>> $result = str_replace('', 0, $result);
Try: $result = str_replace(chr(0), 0, $result);
--
Dan Hardiker [dhardiker@staff.firstcreative.net]
ADAM Software & Systems Engineer
First Creative Ltd