Re: Push an Array, Comma separated.
| From: | Richard Heyes | Date: | Tue, 30 Jun 2009 10:33:04 +0000 |
| Subject: | Re: Push an Array, Comma separated. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294731@lists.php.net to get a copy of this message | ||
> My array:
> Array ( [0] => Demo2.txt [1] => Demo.txt [2] => Demo.txt )
>
> How could I push the values as:
>
> -> Demo2.txt, Demo.txt, Demo.txt?
>
> Not sure which approach is good.
>
> $saveFiles = array();
> array_push($saveFiles, $ufName);
you could use array_push(), or the shorter syntax:
o array_push();
array_push($myArr, 'Demo2.txt', 'Demo.txt', 'Demo.txt');
o Shorter syntax:
$myArr[] = 'Demo2.txt';
$myArr[] = 'Demo.txt';
$myArr[] = 'Demo.txt';
--
Richard Heyes
HTML5 graphing: RGraph (www.rgraph.net - updated 20th June)
PHP mail: RMail (www.phpguru.org/rmail)
PHP datagrid: RGrid (www.phpguru.org/rgrid)
PHP Template: RTemplate (www.phpguru.org/rtemplate)
PHP SMTP: http://www.phpguru.org/smtp