In php,I have to find whether a directory exist. IF it exists not a problem (I will display the hyperlink for that using the dirname)
Here is the sample in which I need help.
dir_name is the directory name
$url = system(~'ls -d /home/myapps/rel/".$dir_name"');
echo $url;(this does not work)
if(preg_match("/No such/",$url)) {
echo'Ther is no match'
}
else{
}
In my code the if block is never executed.(it should execute if the directory does not exist) ;(
~doing there? You also seem to have a wrong understanding of single and double quotes and variable interpolation.