php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27883 I cannot use the explode() command for a string generated with `ls`
Submitted: 2004-04-06 05:30 UTC Modified: 2004-04-06 07:53 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lord_ali at nextra dot ro Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.5 OS: apache 2.0.48
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lord_ali at nextra dot ro
New email:
PHP Version: OS:

 

 [2004-04-06 05:30 UTC] lord_ali at nextra dot ro
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-06 07:53 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 06:01:27 2025 UTC