CSS vertical align center a div inside another div

February 27, 2014

Vertical align middle works by using display: table-cell on parent element and display: inline-block on the child.

jQuery datepicker to show month and year only

February 21, 2014

In reporting specially, datepicker with month and year only are a better way to provide information to form for submission without need of the day. In my case, I modified one picker $( “#month” ).datepicker to fill both month and year input field

php mktime you should be using the time function instead

February 20, 2014

As of PHP 5.1, when called with no arguments, mktime() throws an E_STRICT notice: use the time() function instead Reference: http://php.net/manual/en/function.mktime.php

PHP get next month first day and remaining days to this date

February 20, 2014

Below method is tweaked to take account of December. This method is leap-year safe. The day count must include floor(). From above mktime calculation, not only get the number of days, we can count the hours and minutes till next month first day. Example:

php in_array check for multiple values

February 19, 2014

It depend on how many values to check using in_array. If more than two, better way is loops through array and runs an in_array of it on the checking array. Returns true once something is found, else it returns false. If only two, probably can use if: Reference: http://stackoverflow.com/questions/7542694/in-array-multiple-values

jQuery call same on click function of elements having same ids

February 17, 2014

You cannot have multiple ID’s in your HTML markup. It would be an invalid markup. When querying for $(‘#foobar’) and there are five elements which have that id, you would only get the first instance. So even if there would be a way (…) to apply code to all of those nodes, don’t do it. […]

jquery get the parent element’s id

February 17, 2014

You could use event delegation on the parent div. Or use the closest method to find the parent of the button. The easiest of the two is probably the closest.

CSS to prevent youtube video overlaps div in IE

February 14, 2014

The overlaps doesn’t work with z-index, the only way is put in the two parameters “&wmode”: Example:

PHP difference between single-quoted and double-quoted strings/arrays

February 13, 2014

1.Single quoted strings will display things almost completely “as is.” Variables and most escape sequences will not be interpreted. The exception is that to display a literal single quote, you can escape it with a back slash \’, and to display a back slash, you can escape it with another backslash \\ (So yes, even […]

PHP convert an object to an array

February 13, 2014

For single dimensional array (array) $object works fine. Multi dimension object to array consist of private and protected members. Example single dimensional: All objects to converted to associative arrays: Reference from here