Archive

Archive for the ‘PHP’ Category

Perl Version of PHP’s “ucwords” Function

December 15th, 2009 Masao 1 comment
my $string = 'this is a string of text';
$string =~ s/\b(\w+)\b/ucfirst($1)/ge;
print "$string\n";
Categories: PHP, Perl Tags:

How To Merge PHP Objects

December 12th, 2009 Masao No comments
foreach($objectA as $k => $v) $objectB->$k = $v;
Categories: PHP Tags:

Minimal PhpMyAdmin new server config

November 24th, 2008 Masao No comments

Besides the boilerplate at the top, here’s the least you need to add another database server to the dropdown list in PhpMyAdmin:

$i++;
$cfg['Servers'][$i]['auth_type'] = ‘cookie’;
$cfg['Servers'][$i]['host'] = ‘my.host.com’;

Categories: Linux, PhpMyAdmin Tags:

How to Write to STDERR in PHP

October 26th, 2008 Masao No comments

Writing to standard error in PHP:

   fwrite(STDERR, “hello error string\n”); 

Useful for standalone PHP scripts.

Categories: PHP Tags: