Re: list to array help
| From: | Justin Patrin | Date: | Mon, 29 Mar 2004 21:34:02 +0000 |
| Subject: | Re: list to array help | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181723@lists.php.net to get a copy of this message | ||
Benjamin Jeeves wrote:
Justin Patrin wrote:You can use pathinfo() to get what you want I think. http://php.net/pathinfo -- paperCrane <Justin Patrin>Benjamin Jeeves wrote:I think the list is in scalar list e.g. if I print it as print ("$list_path[0] I get /home/user/index.php /home/user1/index.php /home/user2/index.php /home/user3/index.php and so on. The only delimiter I can think of would to be explode on "/" and then rebuild all the path from the array. But was hoping for a butter way as not sure how to count all the values then? Thank you BenHi all, I have a search where I search inside a document and count how many times I found a given word. My problem is that I have a list e.g. $list_path this is a string of where the file is location on the server what I need help on this getting this list into array format of /somepath/doc1.doc would be $array[0] then /somepath/ doc2.doc would be $array[1] and so on. Then I can use array_count_values for how many times in appears. If I my going off can someone point me in the right way? Thank You BenWhat format is $list_path in? How is it a string-list? If there is a delimiter (; or , for example) you can us explode. $array_path = explode(';', $list_path);