Nash Posted August 19, 2011 Share Posted August 19, 2011 Hi i was wondering if someone could help me understand why in the chapter "navigating directories" the substr function is there. If i take it away then . and .. appears on top of the folders. I read in the book that "That same conditional also checks that the current item isn’t the current directory (marked by a single period on Unix systems) or the parent directory (marked by a double period on Unix systems". But from what i can tell is that the path would be something like this -> /.folder_name . Does the period before a folder show that it is in the same directory because i thought it would go something like this -> ./folder_name. Thanks in advance Nash Link to comment Share on other sites More sharing options...
Stuart Posted August 19, 2011 Share Posted August 19, 2011 ./same_directory ../parent_directory /root_directory Link to comment Share on other sites More sharing options...
mica123 Posted April 14, 2017 Share Posted April 14, 2017 I would be grateful if you could explain what this code (substr($item,0, 1) means in this particular case. Thank you. Link to comment Share on other sites More sharing options...
Larry Posted April 14, 2017 Share Posted April 14, 2017 That returns the first character in $item: a substring starting at position 0 (i.e., the first character) and going a length of 1 characters. Link to comment Share on other sites More sharing options...
Recommended Posts