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