Category: PHP

  • PHP Data Filtering

    PHP have native extension to filter data by either validating or sanitizing it. if (!filter_var($ip, FILTER_VALIDATE_IP) === false) { echo(“$ip is a valid IP address”); } else { echo(“$ip is not a valid IP address”); } if (filter_var($uuid, FILTER_VALIDATE_REGEXP, array(“options” => array(“regexp” => “/^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/”))) === false) { echo ‘Invalid UUID’; }

  • Interesting features of Phalcon PHP framework

    First of all Phalcon is not like any other php framework because it’s a php extension written in C. Php extension are .so files like extension=phalcon.so Since it’s a php extension it’s always loaded if the extension is enabled in php.ini file, even with nothing build. And this going to make this perform fast. The…

  • CodeIgniter Force Clear Browser Cache

    Sometimes when I make changes in live and want visitor to clear their browser cache to see latest changes. I setup http header to expire current cache by setting a back date. here is the code for CodeIgniter. after few days of update I remove this code so browser can cache again. ๐Ÿ˜› $this->output->set_header(“HTTP/1.0 200…