Welcome to WebmasterWorld Guest from 54.158.228.55

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Bag-O-Tricks for PHP III

Couldn't find "part III" in the php library section

     
2:41 pm on May 17, 2005 (gmt 0)

10+ Year Member



has Bag-O-Tricks for PHP II been named something else? I located, the first, second, and fourth sections, but couldn't located the third.

These bag-o-tricks threads have been a real resource to me - as I'm sure they are to others.

Neophyte

2:44 pm on May 17, 2005 (gmt 0)
4:03 pm on May 17, 2005 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



and 4
[webmasterworld.com...]
1:12 am on May 18, 2005 (gmt 0)

10+ Year Member



Cool. Thanks!
6:15 am on May 18, 2005 (gmt 0)

10+ Year Member



Well, all the topics were closed, but I wanted to make a comment. Guess I'll post it here! :)

In the first one, someone mentioned something about variable functions and their usefulness. I didn't feel like sorting through all the other posts to see what people had posted, but I have a really good use for them. A dynamic database class. Say your database class may need to connect to either a MSSQL server or a MySQL server. And, it's possible the server might be running PHP 5, so then you may need to utilize the MySQLi functions, instead. Simple enough, most of those three classes of functions are identical, with a few exceptions, of course. But, here's the example:

class database {
// yada yada
public $type = 'mysqli'; // default type

// more stuff

// example function
public query($sql, $link) {
$query = $this->type.'_query';
return $query($sql, $link);
}
}

Note that this is just an example. I have a single class that I use reguardless of the server type :)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month