by prettyscripts on 2010-02-19 11:19:00 • Leave a comment »
php
there are a few ways to calculate how many days between 2 given dates. the following examples calculates how many days to x'mas from today (19/2/10).method 1 using gregoriantojd($month, $day, $year) function to find out the julian day count. withou…
more »Tags: date, day, php
by prettyscripts on 2010-02-11 10:36:45 • Leave a comment »
php
sometimes the following notice is displayed when accessing array:PHP Notice: Undefined offset [number] in /path/to/your/file.php on line [number] or this:PHP Notice: Undefined index [number] in /path/to/your/file.php on line [number] this means t…
more »Tags: notice, php, undefined
by prettyscripts on 2009-11-02 12:14:38 • 2 comments »
php • symfony
when working on symfony project it's common to run symfony doctrine:build-all (update - in V1.4 symfony doctrine:build --all) constantly. but after the command is run, the collation / encoding is changed to something that wasn’t used when the database wa…
more »Tags: collation, database, doctrine, encoding, php, symfony
by prettyscripts on 2009-09-29 10:22:17 • Leave a comment »
php
use php functions round() to round up or floor() to round down. generic code, based on examples to round to nearest nickel (5c), dime (10c) and quarter (25c):$x = 100 / $cents_to_round_to;$round_up = number_format(round($number * $x) / $x, 2);$…
more »Tags: cents, php, rounding
by prettyscripts on 2009-09-15 14:43:56 • Leave a comment »
php • html • xajax
a case that works in IE but not firefox.
supposed there’s form with a few fields. a button to manually adding more fields to the form. these fields are grouped under the same <div> tag. when the fields are added to the form, the original field va…
more »Tags: append, field, form, php, xajax