|
Posted by Wayne on 11/16/05 02:16
On 15 Nov 2005 10:48:25 -0800, "Rich Kucera" <usidoesit@yahoo.com>
wrote:
>I would like it to be run-time configurable in php.ini
Please god no!!!!! We've been there, we've done that. The php.ini is
not the place to put language altering directives!
>It would be really cool to be able to set that ini option in a header
>file for an application, so it wouldn't affect the entire server. Not
>sure if that is possible with compiler directives.
I think the problem is pretty rare. You're example:
$dir_path_component = array_pop(split('[/]',$dir));
is a good one. But it's not really want you want to do here. You
don't want to pop the top element off of the result, you just want to
return the first item of it. Unfortuantely, PHP doesn't allow you to
the following:
$dir_path_component = split('[/]',$dir)[0];
However, you could write your own function to handle it cleanly. Lets
call that function array_first:
function array_first($array) {
return (isset($array[0]) ? $array[0] : null;
}
$dir_path_component = array_first(split('[/]',$dir));
Problem solved.
[Back to original message]
|