Jump to content
Sign in to follow this  
BrainPill

get_browser error warning for some offsets but not all

Recommended Posts

I have browscap installed this way: 

X:/wamp64/browscap/lite_php_browscap.ini

If I use the following code: 

    <?php 
    $browser = get_browser(null, true);
	var_dump($browser);
	 
	$brows_par = $browser['parent'];
	$browser = $browser['browser'];
		 
	$version = $browser['version'];
	 
 	$platform = $browser['platform'];
	$dev_type = $browser['device_type'];
	$mobile = $browser['ismobiledevice'];
	$tablet = $browser['istablet'];

	?>

 

Then I get error messages for the last 5 variable settings

error output:

Quote

Warning: Illegal string offset 'version'

and for the other offsets same error message except the first 2.

 

see the image for the var_dump value of $browser

Cut-var-dump-browscap.png

 

what causes the Illegal String Offset warning error message?

Edited by BrainPill

Share this post


Link to post
Share on other sites

It's not a reserved variable, you overwrote it:

$browser = $browser['browser'];

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...