plodos Posted September 10, 2011 Share Posted September 10, 2011 $pdf->Write(5, "Title {$inv['cTitle']}, {strstr($inv['cTitle'], ':', true);}"); Code gives an error... How can I use this function correctly {strstr($inv['cTitle'], ':', true); example: cTitle = Robert 20078956 : HOT TEA strstr(cTitle) = Robert 20078956 I want to get before colon ( Link to comment https://forums.phpfreaks.com/topic/246832-strstr-function/ Share on other sites More sharing options...
Cagecrawler Posted September 10, 2011 Share Posted September 10, 2011 You've got an extra semi-colon in there. There should only be one at the end, not after true). Link to comment https://forums.phpfreaks.com/topic/246832-strstr-function/#findComment-1267603 Share on other sites More sharing options...
plodos Posted September 10, 2011 Author Share Posted September 10, 2011 my server PHP Version is 5.2.17... does not support true/false 3. variable... anyway how can I get before : from the sentence ? Link to comment https://forums.phpfreaks.com/topic/246832-strstr-function/#findComment-1267614 Share on other sites More sharing options...
plodos Posted September 10, 2011 Author Share Posted September 10, 2011 $str =explode(':',$cTitle); $str1= $str[0]; echo str1 Link to comment https://forums.phpfreaks.com/topic/246832-strstr-function/#findComment-1267621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.