realWasabi Posted May 18, 2013 Share Posted May 18, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/ Share on other sites More sharing options...
Jessica Posted May 18, 2013 Share Posted May 18, 2013 It's already an array, so just pick the keys you want and concatenate them into a string. Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/#findComment-1430841 Share on other sites More sharing options...
realWasabi Posted May 18, 2013 Author Share Posted May 18, 2013 It's already an array, so just pick the keys you want and concatenate them into a string. That's what I don't know how to do Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/#findComment-1430849 Share on other sites More sharing options...
Solution mac_gyver Posted May 18, 2013 Solution Share Posted May 18, 2013 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? Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/#findComment-1430851 Share on other sites More sharing options...
realWasabi Posted May 18, 2013 Author Share Posted May 18, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/#findComment-1430852 Share on other sites More sharing options...
Jessica Posted May 18, 2013 Share Posted May 18, 2013 I'm not a he. Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/#findComment-1430862 Share on other sites More sharing options...
realWasabi Posted May 19, 2013 Author Share Posted May 19, 2013 I'm not a he. I wasn't talking about you. But you were right as well I guess, I just didn't knew what you meant. So thank you too Quote Link to comment https://forums.phpfreaks.com/topic/278135-how-to-filter-get_browser-output/#findComment-1431040 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.