Insert the below given code within the "head" tags <link rel="icon" href="images/favicon.ico" type="image/x-icon" /> //Make sure that you have uploaded the icon "favicon.ico" to the server
All posts by Pramod T P
Command to list hidden file – Linux
ls -a . The option -a will list the hidden files . css index.php .. detail.php js addedit_banner.php FCKeditor list_category.php admin footer-grade.php loadcategorylist.php adv_search.php footer.php loadcategory.php banner header.php searchbck07.php banner.php hostreview.sql search.php bck htaccess sidebar.php category.php .htaccess test.php
Short keys to list hidden file – Linux
Cntrl + H will list the hidden files
Script to read RSS feed – PHP
<?php
$connect = curl_init("http://www.unixsite.com/feed/rss/");
curl_setopt($connect, CURLOPT_RETURNTRANSFER, true);
curl_setopt($connect, CURLOPT_HEADER, 0) ;
$result = curl_exec($connect);
curl_close($connect);
$data = new SimpleXmlElement($result, LIBXML_NOCDATA);
for($i=0;$i<10;++$i) {
if(empty($data->channel->item[$i]->title)) break;
echo $data->channel->item[$i]->title;
echo $data->channel->item[$i]->description;
}
?>
Validate Email address – PHP
if (!preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $cUrls)) $errorList[]="Invalid Client url - $cUrls. ' ";
echo "Invalid url";
Validate website address – PHP
<?php
if (!preg_match("/^(http(s?)://|ftp://{1})
((w+.){1,})w{2,}$/i", $websitrAddres))
$errorList[]="Invalid Website address. ' ";
?>
How to check whether a variable is an array – PHP
<?php
$array = array('this', 'is', 'an array');
echo is_array($array) ? 'True' : 'False'; // True
echo " ";
$var = 'this is a string';
echo is_array($no) ? 'True' : 'False'; // False
?>
Convert strings to an array – PHP
<?php
$testString = "FirstName,MiddleName,LastName";
$testArray = split(",",$testString);
print_r($testArray);
//Array ( [0] => FirstName [1] => MiddleName [2] => LastName )
?>
<?php
$testString = "FirstName MiddleName,LastName";
list($first, $middle, $last) = split('[ ,]', $testString);
echo "First Name: $first; MiddleName: $middle; LastName: $last";
?>
Find out the first occurrence of a string – PHP
<?php $email = 'firstname@mail.com'; $domain = strstr($email, '@'); echo $domain; // prints@mail.com ?>
Function to find out the substring of a string – PHP
<?php
echo substr('abcdef', 1, 3);
// bcd
?>