Archive for the 'php' Category

2 Jan 2020

isset short way

18:45 | php | 9 views

How we can check if variable is defined or if not than get a default value? The general answer is isset and ternary operator let’s simplify this! or after PHP 7.0.1 you can use this shorter way


18 Apr 2018

use regions in MVS2015 for php files

13:12 | javascript, mvs, php | 234 views

Goal: I want fold-able code for php like I have to js files The texteditor-like editors are great but without regions your life would be difficult. The Microsoft Visual Studio platform provides a very nice feature to use regions. The simpliest way is the following form – you can use it for javascript The php […]


21 Dec 2017

PHP xDebug – xampp – php 7 – chrome

2:40 | php, xampp | 443 views

Goal: not a question, how we can know what is under the hood The PHP debugging is not a trivial case. Could be with the xDebug extension. Follow these steps: A. Xdebug core environment notice: according to the internet you need to disable the output buffering output_buffering = Off for me working with the following […]


1 May 2015

url – parameters as part of the path

9:23 | php, tricky | 367 views

Goal: simplify the url A normal url request with parameters looks like this: In many cases we need the following form: how to: 1. we have to accept the invalid request as a normal one. Let’s create a .htaccess file in the root with the following content: 2. receive the parameter in your php code […]


1 Feb 2015

Get the days between now and the past

0:53 | php | 337 views

Goal: figure out how to get days between two date I’ve found a page: www.timeanddate.com with many interesting date time function. One of them was duration between two date. If you want to know how many days you lived on the Earth just put your birth date as the first date and the actual date […]


25 Jun 2014

php multiline strings in the code

10:24 | php | 402 views

Goal: use multiline strings in the code I have a simple select statement. I want to store it in a variable but I want to forget the concatenation. We can use the heredoc syntax. $query =


24 Jun 2014

Get the client country based on ip address

18:05 | php, web trick | 762 views

Goal: find the client on the map I was supprised when I examined my server’s stat. There were many client from unknown country. This is not too good. I remember an old solution depends on ip2c database. This is nice and easy, but to keep the database updated not too confortable. 1. database solution I […]


23 Jun 2014

simple browser detection on server side with php

19:20 | php | 401 views

Goal: extract basic information from user agent string To follow the user agent strings is like tilting at windmills. My suggestion is a simple way. just implement the minimum and forget the details. Let’s focus on the main browsers and the main operating systems. The first step will be this. Later we will see what […]


21 Jun 2014

switch on php debug mode

12:18 | php | 333 views

Goal: get all error message from the server Just put the following 2 lines to the start of your code.


19 Jun 2014

no more cache – force the reload based on the file date

8:17 | php, web trick | 454 views

Goal: avoid cache in case of changed files The cache is our friend in case of old files. With this code I can use the cache based on my file date. the result is In a little bit friendly shape: Shorter, smarter… Call the no_cache class like


#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }