#27883 [NEW]: I cannot use the explode() command for a string generated with `ls`

From: Date: Tue, 06 Apr 2004 09:30:15 +0000
Subject: #27883 [NEW]: I cannot use the explode() command for a string generated with `ls`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-57577@lists.php.net to get a copy of this message
From: lord_ali at nextra dot ro Operating system: apache 2.0.48 PHP version: 4.3.5 PHP Bug Type: *General Issues Bug description: I cannot use the explode() command for a string generated with ls Description: ------------ I wanted to read all the files from a directory and split them in diferent variables. ./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local/mysql' '--with-pgsql=/usr/local/pgsql/' Reproduce code: --------------- <?php $ali = ls; $oficial = explode(" ", $ali); echo "oficial[0]<br>"; echo "oficial[1]<br>"; echo "oficial[2]<br>"; echo "oficial[3]"; ?> Expected result: ---------------- I would expect to see the files in the directory listed one below the other. Actual result: -------------- I am seeing all the files in one line.... not in diferent lines. Only $oficial[0] is listed, the rest of variables are empty -- Edit bug report at http://bugs.php.net/?id=27883&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27883&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27883&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27883&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27883&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27883&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27883&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27883&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27883&r=support Expected behavior: http://bugs.php.net/fix.php?id=27883&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27883&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27883&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27883&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27883&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27883&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27883&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27883&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27883&r=float

« previous php.bugs (#57577) next »