# AS3 to PHP simple object conversion

**URL:** <https://forum.kirupa.com/t/as3-to-php-simple-object-conversion/327024>\
**Category:** flash\
**Created:** [January 31, 2012, 5:53pm UTC](https://forum.kirupa.com/t/as3-to-php-simple-object-conversion/327024 "2012-01-31T17:53:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigBangz](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@BigBangz](https://forum.kirupa.com/u/BigBangz)\
**Post date:** [January 31, 2012, 5:53pm UTC](https://forum.kirupa.com/t/as3-to-php-simple-object-conversion/327024/1 "2012-01-31T17:53:32Z")

</div>

AS3 code

```auto

<fx:Declarations>
    <!-- this is the RemoteObject used to make the RPC calls -->
    <mx:RemoteObject id="myRemote" destination="MyService" source="MyService"[INDENT=2] endpoint="http://localhost/amfphp/gateway.php"                
            showBusyCursor="true"/>[/INDENT]
        
</fx:Declarations>
protected function button1_clickHandler(event:MouseEvent):void
{
    var aut:VOAuthor; // value object class
    aut = new VOAuthor();
    aut.id_aut = 3;
    aut.fname_aut = "test";
    aut.lname_aut = "123";
    myRemote.saveData(aut);
}

```

Receving PHP code

```php

public function saveData($author) 
{
   $mysql = mysql_connect("localhost", "mx112", "xxxxxx");          
   mysql_select_db("flex360");      
   $query = "INSERT INTO authors (fname_aut, lname_aut) VALUES ('".$author->fname_aut."', '".$author->lname_aut."')";          
$result = mysql_query($query);                 
 return $author;
}

<?php
class VOAuthor { public $id_aut; public $fname_aut; public $lname_aut; var $_explicitType="org.corlan.VOAuthor";}?>   

```

Flex network monitor response : Raw view

```auto

{lname_aut=123, _explicitType=org.corlan.VOAuthor, fname_aut=test, id_aut=3}

```

but If I do this at the end of the php code

```php

return $author->lname_aut;

```

network monitor response is NULL

so the problem is I can print the array but how to cast tht array to a known php type ?  
After 5 days I finnaly figured out flex and mysql using amfphp (-: any one please help ?
