This is duo php function that very useful when we need parser and insert string with any delimiter for example "a-b-c-d-e-f" you can explode to array in php with simple statement
for explode function in php.
-------- PHP Code -------
$str = "a,b,c,d,e,f" ;
$arr = explode(",","a,b,c,d,e,f") ; //This function will extract by "," and add for each character to array
print_r($arr);
---------------------------
Output:
Array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
)
for implode function in php .
-------- PHP Code -------
$arr = array('a','b','c','d','e','f');
$str = implode('-',$arr); //this function will insert '-' character between array element
print_r($str);
---------------------------
Output:
a-b-c-d-e-f
Note :
implode and explode in php5 are useful when you manipulate with CSV file with any delimiter for example white space, comma, colon .
Today's Joke :
Remember that explode is a bomb also implode is a glue.

Tuesday, January 22, 2008
TIP : Explode and Implode duo function in php
Subscribe to:
Post Comments (Atom)
4 comments:
It's Fantastic php related blog. I liked it.
PHP Training
What a great explanation about this function. I am messing up on the internet to find some info about this function and finally found it on your blog post. Thank you so much for explaining it so nicely and sharing the example to show the execution.
Acesoftech is kolkata’s top PHP training center where professional php training is provided. The training is provided by not by the faculties but professionals who have already worked in this field. PHP is in demand, does that mean that its very easy to find job. And if its like that why there are hundreds of students how are jobless in spite of having knowledge of PHP? The reason is simple, they know php but they does not know it professionally. They have not been trained in proper way .
Acesoftech trains in such a way that you can get job instantly because we trains the things which are in demand in the industry.
If you are looking for professional PHP training in Kolkata, acesoftech guarantee you of building your career in PHP.
hi all,
i m using xampp (1.8.3) and oracle 9 (ora92).
when i enable oci8 extension it gives error -
PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll
please help me out.
Post a Comment