The rest of the code of my program is fine.
But I have created an array, which I want to access.
The function and how I intend to access the array to me seems fine, but I keep returning false, when the code is supposed to return true, when testing the value of the array.
Here is the code:
Code: Select all
<?php
$__HTML_LANGUAGE_VERSION = array('HTML' => array("2", "3.2", "4.01", "5"), 'XHTML' => array("1.0", "1.1", "2.0"));
function convertToTagLanguage($tagLanguage, $tagVersion){
if($__HTML_LANGUAGE_VERSION[$tagLanguage]!=NULL){
$versions = $__HTML_LANGUAGE_VERSION[$tagLanguage];
if(is_array($versions) == true){
for($i = 0; $i < count($versions); $i++){
if($versions[$i] == $tagVersion){
return true;
}
}
}
return false;
} else return false;
}
if(convertToTagLanguage("XHTML", "1.1") == true){
echo "conversion was possible";
} else {
echo "conversion NOT possible";
}
?>