Nash 0 Posted August 19, 2011 Report 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 Quote Link to post Share on other sites
Stuart 68 Posted August 19, 2011 Report Share Posted August 19, 2011 ./same_directory ../parent_directory /root_directory Quote Link to post Share on other sites
mica123 0 Posted April 14, 2017 Report 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. Quote Link to post Share on other sites
Larry 428 Posted April 14, 2017 Report 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. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.