My variable $var has the form ‘abc.de’. What does this substr exactly do in this statement:
$convar = substr($var,0,index(".",$var));
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
index()finds one string within another and returns the index or position of that string.substr()will return the substring of a string between 2 positions (starting at 0).Looking at the above, I suspect the index method is being used incorrectly (since its definition is index STR, SUBSTR), and it should be
to find the ‘.’ within ‘abc.de’ and determine a substring of “abc.de”