You are here: Re: filtering xdebug ini keys « PHP Programming Language « IT news, forums, messages
Re: filtering xdebug ini keys

Posted by Rik Wasmus on 10/28/07 13:28

On Sun, 28 Oct 2007 13:53:34 +0100, jemptymethod <jemptymethod@gmail.com=
> =

wrote:

> I've created the following function for returning only ini keys that
> pertain to xdebug. I'm wondering how I might go about doing the same
> sort of thing with one or more of the various "array_" functions
> instead (e.g. array_filter). Since I'm working with xdebug (if you
> can't tell ;) I'll respond in kind with trace data comparing the
> functions.
>
> Thanks in advance....George Jempty
>
> function ini_get_xdebug() {
> $ini_all =3D ini_get_all();
> $ini_xdebug =3D array();
> $xdebug_prefix =3D 'xdebug.';
>
> foreach ($ini_all as $k=3D>$v) {
> if (substr($k, 0, strlen($xdebug_prefix)) =3D=3D $xdebug_prefi=
x) {
> $ini_xdebug[substr($k, strlen($xdebug_prefix))] =3D $v;
> }
> }
> return $ini_xdebug;
> }

What you should be doing:

$ini_xdebug =3D ini_get_all('xdebug');

To answer your question, something like (untested):

<?php
function _is_xdebug($string){
return preg_match('/^xdebug/i',$string);
}
$all =3D ini_get_all();
$keys =3D array_keys($all);
$neededkeys =3D array_filter($keys,'_is_xdebug');
$xdebug =3D array_intersect_key($all,array_flip($neededkeys));
?>
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация