Hey guys,
I was just trying to figure out how...
Check if a variable contains a . in it. Then remove everything after that dot.
Any help, or a point in the right direction would be appreciated.
Thanks,
Mario
| SitePoint Sponsor |


Hey guys,
I was just trying to figure out how...
Check if a variable contains a . in it. Then remove everything after that dot.
Any help, or a point in the right direction would be appreciated.
Thanks,
Mario
$ Available For Hire
Need a website designed or coded? Then feel free to contact me!
PSP Backgrounds - PSPBG.net || Photoshop Brushes - PSBrushes.net
PHP Code:$str = 'xewdwe dfew .fwefwef we f we f we .f wef';
$pos = strpos($str,'.');
if($pos!==false) {
$str = substr($str,0,$pos);
}
echo '<p>',$str,'</p>';
oddz' code works well. You could also use the following which should also do the trick.
PHP Code:$str = 'xewdwe dfew .fwefwef we f we f we .f wef';
$str = strtok($str, '.');
echo '<p>', $str, '</p>';
Bookmarks