Discuss Please Help with Explode in the PHP Development forum on Dev Shed. Please Help with Explode PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
it echoes ARC for $StoreCardDisplayLine1
but $StoreCardDisplayLine2 is blank, supposed to be Approved Repair Centre
is there a correct way for this method
Posts: 2,047
Time spent in forums: 1 Month 3 Weeks 5 h 5 m 45 sec
Reputation Power: 812
Hi,
explode() only returns the parts left and right from the separator. So the separator itself isn't included anywhere.
But I don't even understand what you're trying to do. What's the point of extracting the constant string "Approved Repair Centre"? You could do that by simply using the return value of strpos, though.
Posts: 3,161
Time spent in forums: 2 Months 2 Weeks 1 Day 14 h 5 m 5 sec
Reputation Power: 1736
The delimiter will not be part of the result.
I think you will be better off to use the substr function with the return value from the strpos call.
Something like this: (untested)
Posts: 33
Time spent in forums: 4 h 57 m 26 sec
Reputation Power: 2
Ok The Reasons
User can post Many different values for $StoreCard
But if perhaps the string contains Approved Repair Centre
I would like to display it in the next line on my PDF.
So I need to find Approved Repair Centre and make a variable of it.
Posts: 33
Time spent in forums: 4 h 57 m 26 sec
Reputation Power: 2
Quote:
Originally Posted by MrFujin
The delimiter will not be part of the result.
I think you will be better off to use the substr function with the return value from the strpos call.
Something like this: (untested)
Posts: 2,047
Time spent in forums: 1 Month 3 Weeks 5 h 5 m 45 sec
Reputation Power: 812
Quote:
Originally Posted by jpmul
But if perhaps the string contains Approved Repair Centre
I would like to display it in the next line on my PDF.
So I need to find Approved Repair Centre and make a variable of it.
Is it possible that there's something after 'Approved Repair Centre'? Because if it's always just 'Approved Repair Centre', then simply take the part before this string and the string itself, and you're done.