From: "Ryan A" <[EMAIL PROTECTED]>

> I have a config_inc.php file which has around 60 parameters set in it.
> eg:
> $db_name="something";
> $db_user="root";
> $db_pass="blah";
> $x_installed_path="/home/blah/";
> etc
>
> I have a requirment of echoing out these statements to the client to show
> him how his setup is:
>
> eg:
> echo "DB_name=<font color green>".$db_name."</font>";

One idea is to just fopen() the actual file (not the resulting PHP, which
will be empty), and do some str_replaces to add in the <font> tags, etc. The
rules for that could get tricky, though.

Another option is to use get_defined_vars() before you include the file
(saved into $array1), then save the results again after you include the file
and create the new variables (saved into $array2). Now use
array_diff($array2,$array1) to find the variables that were added. Now loop
through those with foreach() and apply the formatting.

Isn't PHP fun!?

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to