Reverse of strstr() ?
Posted: Sat Jul 08, 2006 8:50 am
I have a string:Now all i'm wanting to do is use whatever is before the '_' (underscore) as this number is a user ID number and i'm trying to get it from it and have it as a cookie but I can't seem to extract just that. I can get everything after the underscore but not before.^That's what i'm using at the moment to get everything after the '_' but I want before it. 
Any ideas?
Code: Select all
1_vbJG4fWHr5oQrVZmoIRdUZ58K6MNRC9ieJOBpGjBexsvONd6wvCode: Select all
<?php
$thecook = "1_vbJG4fWHr5oQrVZmoIRdUZ58K6MNRC9ieJOBpGjBexsvONd6wv";
$thecook2 = strstr($thecook, '_');
echo $thecook2;
?>Any ideas?