note 95904 deleted from function.end by danbrown
| From: | danbrown@php.net | Date: | Tue, 30 Mar 2010 14:07:08 +0000 |
| Subject: | note 95904 deleted from function.end by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167527@lists.php.net to get a copy of this message | ||
Note Submitter: developers dot working at gmail dot com
----
This helped me when i need to put commas between the array elements but not in the last<?
function removeCommasatLast(array $Options = array())
{
foreach ($urlOptions as $option){
if(!(end($urlOptions) == $option)){ //this is where it works great
$selectOptions.=$option.",";
}
else{
$selectOptions.=$option;
}
}
$sql= "SELECT $selectOptions FROM TableName";
}
removeCommasatLast(array('register','index' ));