echo ‘Today day: ‘. date(‘Ymd’) .”\n”; echo date(‘Ymd’, strtotime(‘-1 day’)); echo strtotime(“now”), “\n”; echo strtotime(“10 September 2000”), “\n”; echo strtotime(“+1 day”), “\n”; echo strtotime(“+1 week”), “\n”; echo strtotime(“+1 week 2 days 4 hours 2 seconds”), “\n”; echo strtotime(“next Thursday”), “\n”; echo strtotime(“last Monday”), “\n”; echo ‘Today day: ‘. date(‘Ymd’) .”\n”; $dateprev=date(‘Ymd’, strtotime($date. ‘-1 day’));
Category Archives: PHP
Dates in PHP and Mysql
$mysqldate = date( ‘Y-m-d H:i:s’, $phpdate ); $phpdate = strtotime( $mysqldate );
How To Optimize Your Site With GZIP Compression .htaccess
Setting up the server The “good news” is that we can’t control the browser. It either sends the Accept-encoding: gzip, deflate header or it doesn’t. Our job is to configure the server so it returns zipped content if the browser can handle it, saving bandwidth for everyone (and giving us a happy user).
PHP mail validation function
function valid_email($str) { return ( ! preg_match(“/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix”, $str)) ? FALSE : TRUE; }
Custom Trigger View Recordset Data
For PHP:$_SESSION[‘kt_login_id’] = $tNG->getPrimaryKeyValue(); $_SESSION[‘kt_login_user’] = $tNG->getColumnValue(‘name_usr’); For ASPVBScript:Session(“kt_login_id”) = tNG.getPrimaryKey Session(“kt_login_user”) = tNG.getColumnValue(“name_usr”) SET Trigger_Custom = Nothing For ColdFusion:SESSION.kt_login_id = tNG.getPrimaryKeyValue(); SESSION.kt_login_user = tNG.getColumnValue (“name_usr”);
PHP – remove tag from string
<? $content = “this is something with an <img src=\”test.png\”/> in it.”; $content = preg_replace(“/<img[^>]+\>/i”, “(image) “, $content); echo $content; ?> The result is: this is something with an (image) in it.