Mega Code Archive

 
Categories / Php / Strings
 

Break $url down into three distinct pieces

<?php    $url = "http://www.rntsoft.com";    $parts = ereg("^(http://www)\.([[:alnum:]]+)\.([[:alnum:]]+)", $url, $regs);    echo $regs[0];         echo "<br>";    echo $regs[1];         echo "<br>";    echo $regs[2];         echo "<br>";    echo $regs[3];      ?>