dominod Posted August 6, 2010 Share Posted August 6, 2010 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.. Link to comment https://forums.phpfreaks.com/topic/209979-get-value-before-andor-after-x-in-a-string/ Share on other sites More sharing options...
Adam Posted August 6, 2010 Share Posted August 6, 2010 $res = explode('x', $resolution_value); You'll then have an array containing the values. Link to comment https://forums.phpfreaks.com/topic/209979-get-value-before-andor-after-x-in-a-string/#findComment-1095995 Share on other sites More sharing options...
JonnoTheDev Posted August 6, 2010 Share Posted August 6, 2010 $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]; Link to comment https://forums.phpfreaks.com/topic/209979-get-value-before-andor-after-x-in-a-string/#findComment-1095999 Share on other sites More sharing options...
dominod Posted August 6, 2010 Author Share Posted August 6, 2010 Solved it with list($x, $y) = explode('x', "1440x900"); Thanks guys Link to comment https://forums.phpfreaks.com/topic/209979-get-value-before-andor-after-x-in-a-string/#findComment-1096126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.