Page 1 of 1

function array help!

Posted: Wed Dec 08, 2004 5:29 pm
by Steve123
patrikG | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Hello,

If I used a function such as [url=http://uk.php.net/manual/en/function.get-browser.php]get_browser()[/url] I am resulted in an array which looks like:

Code: Select all

Array
(
    [browser_name_regex] => ^mozilla/5\.0 (windows; .; windows nt 5\.1; .*rv:.*) gecko/.* firefox/0\.9.*$
    [browser_name_pattern] => Mozilla/5.0 (Windows; ?; Windows NT 5.1; *rv:*) Gecko/* Firefox/0.9*
    [parent] => Firefox 0.9
    [platform] => WinXP
    [browser] => Firefox
    [version] => 0.9
    [majorver] => 0
    [minorver] => 9
    [css] => 2
    [frames] => 1
    [iframes] => 1
    [tables] => 1
    [cookies] => 1
    [backgroundsounds] => 
    [vbscript] => 
    [javascript] => 1
    [javaapplets] => 1
    [activexcontrols] => 
    [cdf] => 
    [aol] => 
    [beta] => 1
    [win16] => 
    [crawler] => 
    [stripper] => 
    [wap] => 
    [netclr] => 
)
I was wondering if there was any way to extract certain parts such as frames and javaapplets?.

Thank you


Steve 8)

patrikG | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Wed Dec 08, 2004 6:20 pm
by josh

Code: Select all

$array=get_browser();
echo ($array[frames]);

Posted: Wed Dec 08, 2004 7:28 pm
by dull1554
to expand on what jshpro2 said then you would do something to the effect of:

Code: Select all

$frames = $array['frames'];
$javaapplets = $array['javaapplets'];

Posted: Thu Dec 09, 2004 6:33 am
by CoderGoblin
Another alternative is to use the [pg_man]extract[/pg_man] function. In this case you may find that the indexed array contains too many options, but it is just a thought..