# \[php + flash\] php variables into flash

**URL:** <https://forum.kirupa.com/t/php-flash-php-variables-into-flash/256336>\
**Category:** programming\
**Created:** [April 2, 2008, 5:12am UTC](https://forum.kirupa.com/t/php-flash-php-variables-into-flash/256336 "2008-04-02T05:12:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dragonknight](https://avatars.discourse-cdn.com/v4/letter/d/a6a055/32.png) [@Dragonknight](https://forum.kirupa.com/u/Dragonknight)\
**Post date:** [April 2, 2008, 5:12am UTC](https://forum.kirupa.com/t/php-flash-php-variables-into-flash/256336/1 "2008-04-02T05:12:15Z")

</div>

i’m trying to get php to read how many .swf files are in a folder called “horns”

```php

<?

$total= count(glob('./horns/'));
$total=$total+1;
// loads "hornNum" variable and ignores Server Automated Ads
echo "hornNum=" . $total . "&ignore=advert";

?>

```

but when i do try it, it some how becomes a ten or something

2 would end up to being 20

heres the actionscript code that leaves me thinking that

```auto
on (release) {
    _root.pethorns++
    var i:Number = _root.pethorns;
    if (_root.pethorns>=_root.hornNum+1) {
        _root.pethorns = 1;
        _root.loadhorns("1.swf")
    } else {
        _root.loadhorns(i+".swf")
    }
}

```

and heres the code on frame 1 of my flash file

```auto
function loadhorns(obj) {
    _root.defaultpet.defaulthead.defaulthorn.loadMovie("horns/"+obj);
}
function petskin(obj) {
    var skincolor:Color = new Color(obj);
    skincolor.setRGB(_root.colorskin);
}
_root.colorskin = "0x006600";
loadVariablesNum("itemcounter.php?nocache="+random(65000), 0, "POST");
_root.pethorns = 1;
_root.pose = 1;

```

and heres the actual flash file right here  
[http://gaiahost.freeweb7.com/cap/test.swf](http://gaiahost.freeweb7.com/cap/test.swf)

what i tried to do was make php count the files in the “horns” folder and pass it to flash as a variable

seems i did something wrong somewhere x.x;;
