PHP Break $Url Down Into Three Distinct Pieces – String Function

<?php
   $url = "http://www.w3mentor.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];
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.