Jump to content

How to filter get_browser output


realWasabi
Go to solution Solved by mac_gyver,

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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