Jump to content

How to filter get_browser output


realWasabi

Recommended Posts

Hello

 

I'm using the get_browser function to display visitors browser, OS etc. for logging purposes.

However, I don't want to log the complete output of get_browser as it's quite a few lines.

 

 

How can I filter the output so this (example):

 

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

 

 

 

becomes this:

 

Firefox 0.9, WinXP

 

 

I tried using explode, but without any luck. 

Link to comment
https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/
Share on other sites

in one of the other help forums where you posted this, someone showed you specifically how to reference the ['browser'] field of the array. exactly where are you stuck at in doing this basic task? what have you tried?

 

I completely misread his answer. I thought he had misunderstood my question, thus answering something else. What he answered were what I was looking for:

$ex = get_browser(null, true); 
echo $ex['browser'];  

I'm sorry, thank you for pointing that out.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.