Jump to content

Get value before and/or after "x" in a string?


dominod

Recommended Posts

Hi,

 

I am working with screen resolutions and so far I managed to get the users screen resolution into a cookie which states "1440x900" (My resolution).

 

I just wonder how I can get width and height in two different strings? Something that removes "x" and everything after it to get width and vice verca for height..

:shrug:

 

$res = explode('x', $resolution_value);

 

You'll then have an array containing the values.

 

Just to add to that, if you aren't sure about arrays.

$res = explode('x', $resolution_value);
$width  = $res[0];
$height = $res[1];

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.