Hi guys, i have 2 questions that i hope someone will help me on. Because its killing me, i can't solve it.
1) Write a function that will convert an array of lower case strings passed by reference into an array of upper case strings
e.g function convert(&$array_strings){
//insert code
}
I tried this:
function convert(&$array_strings)
{
$array_strings="hello this is php coding in lower case to upper case";
$higher=strtoupper($array_strings);
print("$higher");
}
2)Using regular expressions generate a function that will check if a filename stored in a string is of the correct format. The function should return a Boolean result. Any 1 upper case letter, followed by 3 lowercase letters, followed by any digit, followed by a .php or .PHP file
eg. Gone8.php
I tried this:
function regular_expressions($boolean)
{
if(preg_match("/[A-Z]{1}[a-z]{3}[0-9][.]p[Hh]p/","Gone8.php"))
{
return 1;
if ($boolean == 1)
{
print("true<br/>");
}
return false;
}
Extra: what happens if you try "Gone8.phpProblem" Does it return true or false? Can you fix the problem if there is one?" --->Can anyone explain the answer and rationale behind it to me ?
Many thanks!