Jump to content

php-utils


Buyocat

Recommended Posts

I have created a package of utilities written for PHP 5.  I would very much appreciate it if any users gave it a try, and even more if they left some feedback.  The goal of the tools is to take care of commonly run into problems, but I also want them to be distinct (so you can pick and choose) and simple to understand and use.  I believe the target audience is a newcomer to PHP who hasn't already constructed his own tools or adopted larger tools (such as ADODB).  There are utilities for database querying, templating, benchmarking to name a few.

 

They're available at sourceforge (linked in my signature) and also from my site (with some sample uses) http://vaultedceilings.net

 

Thanks in advance, Buyo

Link to comment
Share on other sites

In your IncludeManager class you have the following method:

 

<?php
function get($file) {
static $previous_includes = array();
if ($previous_includes[$file])
	return true;
if (!exists($file))
	return false;
$previous_includes[$file] = true;
include(INCLUDE_MANAGER_PATH . $file);
return true;
}
?>

 

I believe that the following is tautologically equivalent to your code without the added overhead of the $previous_includes hash:

 

<?php
function get($file) {
return (exists($file) ? include_once(INCLUDE_MANAGER_PATH . $file) : false);
}
?>

 

I haven't looked too closely at everything else --but I think you have some good stuff here. 

 

On a side note: Are you still looking for some folks to start an open source project?  If so, drop me a line.

 

Best,

 

Patrick

Link to comment
Share on other sites

Thanks for the reply, the real point of the get method is the hash table.  The reason for the hash table is to avoid having to call include_once.  Basically it's a trade off between memory for execution speed.  Every time you call include_once you break out of execution and do a system call to check whether the file was already included.  The hash table takes some extra memory but eliminates the extra system call.

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.