String Funtion

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 13, 2014   (RSS)

By nmsinc - May 12, 2014

I have never captured a portion of a string in PHP and need some help.

I have a string: 123|456 and I need to capture the string portion to the left of the "|" so that the value would be 123

Any help would be appreciated

Thanks,

nmsinc

nmsinc

By jenolan - May 12, 2014

$arr = explode( '|', "123|456" );
echo $arr[0];   // Will be '123'

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life