sharpkj Posted June 27, 2006 Share Posted June 27, 2006 I have the following code..[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] // Get the position of the first space $firstSpacePosition = strpos($line, ' '); // Update array for the file names (everything after the first space) $this->fileArray[$i] = substr($line, $firstSpacePosition, strlen($line)); // Update array for the directory names (everything before the first space) $this->directoryArray[$i] = substr($line,0,$firstSpacePosition); // Increment the counter $i++; [/quote]This looks at a line, finds the first space, then just takes everything after the first space and makes it fileArray[$i]. Everything before the first space becomes directoryArray[$i]. I'd like to make it so that everything before the first space is still directoryArray[$i], but then the word after the 1st space becomes secondArray[$i] and everything after the SECOND space becomes fileArray[$i].Example/directory/directory secondword file that I want displayedwould bedirectoryArray = /directory/directorysecondArray = secondwordfileArray = file that I want displayedThanks for the help! Link to comment https://forums.phpfreaks.com/topic/13038-reading-after-the-2nd-space/ Share on other sites More sharing options...
sharpkj Posted June 27, 2006 Author Share Posted June 27, 2006 any ideas? Link to comment https://forums.phpfreaks.com/topic/13038-reading-after-the-2nd-space/#findComment-50165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.