To removes (trim) all white space around image (example on JPG), you can use this short code. How it’s work? It just a simple way. This script will find out where is the “WhiteSpace” stops, then it will copy everything inside the white space border. <?php //load the image! it's possible to open remote image from another website, just put [...]
I’ve got simple email validation. Here’s the code: <?php function is_validemail($email) { return preg_match('/^[\w.-]+@([\w.-]+\.)+[a-z]{2,6}$/is', $email); } $email = "simple.email.address@shouthuns.com"; if(is_validemail($email)) { echo ("email validated"); } else { echo ("invalid email given"); } ?> This function work fine for me! Please enjoy the code ;)
First you have to do is enable the CURL module in your php.ini. Or at the time of installation by adding the flag: -with-curl[= DIR] where DIR is the location of the directory containing the lib and include directories. For more information on installing, please read the literature from PHP site: http://php.net/manual/en/curl.installation.php or in CURL site : http://curl.haxx.se/libcurl/php/ After that, [...]
You know guys, to get IP Address (Hostname) and Browser Name from user who visited our page, you can use simple function on PHP. Here’s the code: echo 'Your IP/Host : '.gethostbyaddr($_SERVER['REMOTE_ADDR']); echo 'Your browser : '.$_SERVER['HTTP_USER_AGENT']; You can see the sample page here : http://www.shouthuns.com/sample/get-ip-browser.php. And here if you want download source: Download Here! Reference : http://php.net/manual/en/function.gethostbyaddr.php Incoming search [...]
My friend asking me about PHP function for “Get Between Tags” that she gets from the internet. She asked me how to replace eregi function that has been deprecated since PHP 5.3.0. Where the previous function (which contains eregi function) as follows: function get_between_tags($tag1, $tag2, $string) { if (eregi("$tag1(.*)$tag2", $string, $out)) { $outdata = [...]