Use php date function and minus (-1) days from today’s date $smart_yesterday = strtotime(date(‘Y-m-d’, strtotime( ‘-1 days’)));
Tag: PHP
IP Ban using htaccess
Use the following code in .htacces file. Then all the request from that ip will be denied. This will helps to protect the website from particular ip attack. ## USER IP BANNING <Limit GET POST> order allow,deny deny from 192.168.1.0 allow from all </Limit>
limit the number of characters in a string php
String functions are have good role in php programming. Some times the php developer wants to limit the number of characters. In certain situations have one function. It is very useful and easy to apply PHP Function is Syntax: substr(string, <start position>,<end position>) Eg: $string=’I am a web developer”; substr($string,0,6); output: I am a
extract date from datetime in php
PHP is a object oriented programming language for website building. PHP has number of in-built of functions to do different tasks .one important function is date.We can use date php function in different ways. Sometimes date from the back-end as timestamps. It means contains both date and time. some situations only need date part so…
Socialengine select Query wih random() function
$customersTable = Engine_Api::_()->getItemTable(‘customer’); $select = $customersTable->select() ->where(‘enabled = ?’, 1) ->order(‘RAND()’) ->limit(3);