Page 1 of 1

how to split cut trim a value into 2 new vars?

Posted: Fri Jun 08, 2007 10:36 pm
by ianhull
hi guys,

I need to trim split slice cut or whatever it is to get this into two variables.

Code: Select all


$value1___$value2

I placed the three undescores there so that I could somehow modify it but I can't work it out.

Please help.

Thanks

Posted: Sat Jun 09, 2007 2:05 am
by afbase

Code: Select all

$value1."____".$value2;
i'm not sure what you are looking for. Please elaborate, if the value(s) are strings try substr()

Posted: Sat Jun 09, 2007 7:04 am
by superdezign
Lol. Underscores aren't magical.
If you already have the variables, why would you need to add underscores....?


I'm pretty sure you're after this:

Code: Select all

$str = "Blah___Blah some more";
$strArray = split('___', $str);
$value1 = $strArray[0];
$value2 = $strArray[1];
If not... Then we're totally lost.

Posted: Sat Jun 09, 2007 4:19 pm
by feyd
Don't use split(), use explode() or, if necessary preg_split(), but never split().