
Originally Posted by
arkinstall
...Though I did have to start up my web server to test the code before I submitted it...
You should think about getting an editor or IDE that can run a CLI instance of PHP to test run scripts.
@Logic:
$str = 'helloxhello';
using explode or preg_split doesn't allow for number verification.
Width: Hello
Height: Hello.
That is why you run checks on the value. 
Could as easily run those checks like this:
PHP Code:
$str = '1024x768';
@list( $width, $height ) = preg_split( '/[xX]/', $str, -1, 1 );
if ( !isset( $width, $height ) )
// Somethig bad!
settype( $width, 'int');
settype( $height, 'int' );
Or even:
PHP Code:
$arr = preg_split( '/[xX]/', $str, -1, 1 );
$arr = array_pad( array_filter( $arr, 'ctype_digit' ), 2, 0 );
So many ways.
Bookmarks