# Actionscript equivalent of PHP's explode()

**URL:** <https://forum.kirupa.com/t/actionscript-equivalent-of-phps-explode/170412>\
**Category:** flash\
**Created:** [November 25, 2005, 6:57pm UTC](https://forum.kirupa.com/t/actionscript-equivalent-of-phps-explode/170412 "2005-11-25T18:57:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![logikal2](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/logikal2/32/1143_2.png) [@logikal2](https://forum.kirupa.com/u/logikal2)\
**Post date:** [November 25, 2005, 6:57pm UTC](https://forum.kirupa.com/t/actionscript-equivalent-of-phps-explode/170412/1 "2005-11-25T18:57:02Z")

</div>

I remember that in PHP, there was a nice little function that breaks apart a string. For example:

$string = “1||2||3”;  
var\_dump(explode(’||’, $string));

How would I do this in Actionscript? Here’s what I have so far:

```auto
xVals = new Array();
newstuff = new Array();

xVals[1] = 20;
xVals[1] = xVals[1] + "," + 40;

```

so,

```auto
xVals[1] = 20,40;

```

newstuff = explode(’,’, xVals[1]));

Any help would be greatly appeciated, thanks  
~Matt
