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.. Quote 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. Quote 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]; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.