Originally posted by gid
Dang, someone beat me to it I see after hitting preview, but oo, I guess I'm a regex God? 😉
Dunno 'bout that, but theeper's code could've been shortened to
$string = "64/30.53.88.207.in-addr.arpa";
list($variable1, $array2) = explode('/',$string);
list($variable2, $variable3) = explode('.',$array2,2);
echo "$variable1 <BR> $variable2 <BR> $variable3";
...and yours to
$t = '64/30.53.88.207.in-addr.arpa';
if(preg_match('#^(\d{1,3})/(\d{1,3})\.([-a-z\d.]+)$#', $t, $r)) {
echo $r[1] .' - '. $r[2] . ' - '. $r[3];
}
...but which is faster and which is easier to read?