| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
an ardent learner
Join Date: Jan 2006
Posts: 114
|
Can anybody tells me whether there is a built-in function to perform splitting or joining of arrays without using delimiter?
Please don't give me alternative solution by ways of custom function. I know how to do it with my own function but I would like to know if there is already a PHP built-in function to cater for this scenario. TQ. |
|
|
|
|
|
#2 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
strstr
preg_match
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
|
|
|
#3 |
|
an ardent learner
Join Date: Jan 2006
Posts: 114
|
Thanks. Will try to understand what these built-in functions you recommended will do. Actually I want to use simple solution to convert from string to array and array to string without having to manually split or join them. Built-in functions like explode and implode require only two lines of coding.
|
|
|
|
|
|
#4 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
ActionScript Code:
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman Last edited by Flash Gordon; 01-13-2006 at 05:10 AM.. |
|
|
|
|
|
#5 |
|
an ardent learner
Join Date: Jan 2006
Posts: 114
|
But the "split" example you gave above and "join" function are in ActionScript which accepts null delimiter. It's a different case in PHP which does not allow null delimiter and I end up writing my own function.
|
|
|
|
|
|
#6 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Perhaps if you knew why you are so attiment on not having a delimeter of create custom functions, we could help better.
Otherwise, just use the delimeter. It can't be that much of a hassle.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#7 |
|
an ardent learner
Join Date: Jan 2006
Posts: 114
|
Actually, I'm trying to break up a long sentence and store each character into an array and perform some checking and manipulation, and then join them back again into a manipulated sentence without having to write a custom function to perform the conversion prior to and after the checking. I need to have a ready array with the each character of the Text being splitted into respective slot. before performing the necessary check. Without delimiter, I can't use the one line of "explode" and "implode" function . By using another custom function, the performance speed may be affected if the text is too big. Hope this helps to explain my concern.
I've been always trying to improve performance speed and reduce bandwidth cost and find any possible solution if applicable, use the already built-in function, otherwise, write my own custom function. BTW, thanks for providing the two built-in functions. Will look into them. |
|
|
|
|
|
#8 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
What you want can't be done. Here is a simple enough function to manipulate:
PHP Code:
Code:
H e l l o W o r l d
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman Last edited by Flash Gordon; 01-13-2006 at 07:15 AM.. |
|
|
|
|
|
#9 |
|
an ardent learner
Join Date: Jan 2006
Posts: 114
|
Thanks Flash. As I mentioned, I'm not asking for anybody to provide me a custom function. I myself had written my own custom function using a for loop, which used the strlen and substr like what you did above. Still, my main concern is the performance speed.....
|
|
|
|
|
|
#10 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
there will be no performance hit with that code, I'm quite sure. Built-in functions do the same things.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| LoadVars or XML with PHP on DIFFERENT servers doesn't work. | Sckz | Server-Side Scripting | 4 | 07-14-2005 12:01 AM |
| Problems loading PHP file into Flash | lrempel | ActionScript 2.0 | 1 | 01-25-2005 12:11 PM |
| Test-Movie using PHP doesn't work anymore on 10.3 Panther | Sckz | Server-Side Scripting | 2 | 12-16-2004 03:00 AM |
| how to link Action Script to a remote PHP | atomskreymx | Server-Side Scripting | 2 | 11-16-2004 07:01 AM |