1 2 3 4 5 6 7
<?php $str = "This is the title-This is an example"; $title = substr($str, 0, strpos($str, '-')); var_dump($title);
1
string(17) "This is the title"