I have seen other
I have a string
" cccc cccc - fff"
I need to return
"cccc cccc" I don’t need to delimiter too
I tried to echo the result of
substr($mystring , 0, strpos($mystring , "-"));
but it return nothing
I also tried
list($result, $trash) =split('-', $mystring); echo $result; echo $trash;
resulted returned the main string and trash resulted nothing
i’m using wordpress and for some reason it is not working.
I need to trim my title, i’m using get_the_title() and i’m trying to trim it
Read more here: remove part of string after delimiter in php