[FX.php List] Exploding the carriage returns within a Filemaker field

Dale Bengston dbengston at preservationstudio.com
Sat Nov 25 08:27:35 MST 2006


I think what you're running into is the inconsistent encoding of  
carriage returns across platforms. To expand on Gjermund's idea, you  
could use nl2br() to replace your carriage returns with <br />  
(generally for display of data with returns in a browser page) and  
then use explode() to explode the elements by <br />.

Dale

On Nov 25, 2006, at 4:40 AM, Gjermund Gusland Thorsen wrote:

> nl2br()
>
> 2006/11/24, Gary Sprung <gary at gnurps.com>:
>> Howdy,
>> I am trying to use the explode() function to get the return- 
>> separated values
>> within a Filemaker field into an array. I¹ll then do a foreach()  
>> on the
>> array to display the values. I seem to be unable to get the delimiter
>> character correct. The syntax explode("\r",$fieldcontents) does  
>> not work,
>> yielding an array of only one element with all the values and  
>> their return
>> characters. "\r\n" and "\n\r" are no better. Can anyone suggest  
>> what's going
>> wrong here?
>>
>> Code:
>> $FMvariable = $Data['FMfieldName'][0];
>> $FMarray = explode("\r",$FMvariable);
>>
>> echo '<pre>';
>> echo print_r($FMarray);
>> echo '</pre>';
>>
>> Result:
>>
>> Array
>> (
>>     [0] => Board Volunteer Recruitment
>> staff recruitment
>> accessibility
>> other
>> )
>> 1
>>
>> In the above, what I want is for "Board Volunteer Recruitment" to  
>> be one
>> element, "staff recruitment" to be another element,  
>> "accessibility" a third,
>> and "other" a fourth.
>>
>> Thanks,
>> Gary
>>
>> --------
>> Gary Sprung
>> GNURPS Consulting
>>
>> gary at gnurps.com
>> www.gnurps.com
>>
>> Landline: 720-565-9933
>> Cell: 303-859-9331
>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



More information about the FX.php_List mailing list