Posts Tagged ‘PHP’

Google Code Jam Templates

Google Code Jam Logo Thumbnail

Here are some templates that are a good start for Google Code Jam. C++ Compile Execute Python Input: input, raw_input() String parsing: strip(), split() Execute Java This is an ajusted version of mystics solution for “Dancing with Googlers”. You might want to take a look at Scanner and PrintWriter. Adjust the path and execute it [...]

PHP: A strange language

PHP logo thumbnail

Inconsistency Starting and ending PHP The following snippet is valid PHP-code: Source: StackOverflow.com (You can find some explanations there.) Underscores Some functions use underscores between words, while others do not: gettype vs. get_class Order of Arguments Sorting This doesn’t work. If you don’t know why, you should take a look at sort. PHP Logo Add [...]

Comparing Dates in PHP and MySQL

PHP logo thumbnail

Sometimes you need to know compare PHP dates. You need to know what is later or if both dates are the same. PHP time formats and functions PHP knows these time / date formats: UNIX Timestamp: Integer – The number of seconds after 1970. Related functions are int mktime([ int $hour = date("H") [, int [...]

PHP: PEAR MDB2

PEAR-Logo

PEAR is short for PHP Extension and Application Repository. It provides a very easy method to get some common classes. PEAR MDB2 is a database class. It is a successor of PEAR DB. I took a look at version 1.4.1 which is currently the latest stable one. Install PEAR You can install PEAR on Ubuntu [...]

Benchmarking PHP

PHP-logo

I used ApacheBenchmark (ab) to make a few Benchmark tests I was interested in. If you like to view some more, go to www.phpbench.com. The most important options are: -n: Number of requests to perform -c: Number of multiple requests to make An empty file: Now I make 1000 requests to this empty file: Time [...]