12
I got the following String:
$link = '13542345/essa_e_minhastring';
How do I take only the value up to the "/" bar and ignore the rest ?
I would like to assign this value to a variable.
I’m using the following code, but it just breaks the string...and does not separate into a variable as I need it:
$cod = str_replace("/","<br>",$link);
echo $cod;
The result is:
13542345
essa_e_minhastring
I need it to be just:
13542345
Thank you very much, it fell like a glove.
– Charles Fay
And if I want to give one
explode
in thevalue
of aarray
? It returns an error stating that it expects astring
and received aarray
, how to proceed in that case??– Marcos Henzel
@Marcoshenzel
explode
works on strings only.– Sergio