*Note: The article presented here is written by authors not affiliated with hashemian.com.
This site is not responsible for any errors, omissions, or objectionable content.
Exercise care before engaging in business with any companies mentioned in this article.

Go to: /articles/2005/10/01/ for other articles.

WebDev: JavaScript equivalent of PHP explode function

Dear Publisher,

You can publish this article wherever you feel like, as long as you use the resource box. Although it is not necessary to inform me, but I feel happy if some tell me that my article has been posted :-)

-- Amrit

==========================================

Article Title: JavaScript equivalent of PHP explode function Category: WebDev Copyright © 2005 Amrit Hallan

==========================================

== Article Begins ==

In PHP we can easily break a long string into smaller parts by using the explode() function of PHP. In run rime, this function works like this:

== code begins ==

$longstring="Most of the time Amrit is confused -- OK, not most of the time"; $brokenstring=explode(" ", $longstring);

== code ends ==

After the execution of the second command the variable $brokenstring is an array such that,

$brokenstring[0]="Most" $brokenstring[1]="of" $brokenstring[2]="the" $brokenstring[3]="time" $brokenstring[4]="Amrit" $brokenstring[5]="is" $brokenstring[6]="confused"

and so on. So how do we do it in JavaScript. In JavaScript there is a split() function that achieves the same objective, although the syntax is a bit different.

== code begins ==

var longstring="Most of the time Amrit is confused -- OK, not most of the time"; var brokenstring=longstring.split(" ");

== code ends ==

Now the variable brokenstring has all those words.

== Article Ends ==

About the author: ===============================================

Amrit Hallan is a freelance copywriter, and a website content writer. He also dabbles with PHP and HTML. For more tips and tricks in PHP, JavaScripting, XML, CSS designing and HTML, visit his blog at www.aboutwebdesigning.com

===============================================

Article Topics
Adsense Advertising Bankruptcy Blog Credit Card
Debt Google Ira Marketing Mortgage
Real Estate Rental Retirement Rss Search Engine
Seo Stocks Tax
Recent Articles

Read Financial Markets  |   Home  |   Blog  |   Web Tools  |   News  |   Articles  |   FAQ  |   About  |   Contact

© 2001-2012 Robert Hashemian
Support the effort
Liked this page?
Please consider creating a link to it
from your Web site.

hashemian.com
هاشمیان.com

Home
Blog
Web Tools
News
Articles
FAQ
About
Contact
Financial Markets

Visits: Powered by hashemian.com

Search Hashemian.com