Cabron Connector Logo
Another Open-Source Implementation of PHP - Flash Remoting
ActionScript > PHP
The data type conversion from ActionScript to PHP is presented in the table below:
ActionScript Serialized PHP
String S string
Boolean B boolean
Number N real
NaN X null
null X null
undefined X null
Array H Indexed array
Object H Associative array
MovieClip M Associative array
Function F null
recursion S string

If you have recursion in your data structure passed as parameter to a method invocation, this fact will be detected by the deserializer.

In the PHP service this parameter will appear as a string containing "**recursion".

If you want to transmit a movie as a parameter, this will appear in the PHP service as an associative array. In the current release only those properties are transmitted, which are enumerable using a for in loop. The movieclip-specific properties (_x,_y,_width,_height,_alpha and so on) will not be transmitted.
In fact a movie will be transmitted exactly like an Object.
PHP > ActionScript
The data conversion from PHP types to ActionScript types is presented below:
PHP Serialized ActionScript
string S String
boolean B Boolean
integer, double N Number
null X null
Indexed array A Array
Recordset-like array R Array of Objects
other array H Object
CabronRecordSet object R Array of Objects
other object X null

An array from PHP can be transitted in different manners to the Flash.
If the array:
  • has continous indexes
  • the lowest index is 0
  • each entry of the array contains an array
  • all the keys of the 0 index array are strings
  • all the arrays have the same number of elements
  • all the keys of the 0 index array are set in every other array
the array will be serialized as recordset. This means that it will take fewer bytes to transmit it. In the ActionScript, it will be visible as an Array of Objects, with properties named as the keys of the 0 index array.

If the array
  • has continous indexes
  • the lowest index is 0
the array will be serialized, and will appear in ActionScript as an Array object.

In other cases, the array will be serialized as a Hashtable, and in ActionScript it will be represented as an Object, with properties named as the keys of the array.

Result set
The result sets from a query execution can be returned from a PHP service by passing them to a CabronRecordSet instance.
new CabronRecordSet($result,"MYSQL");
Currently only the MySQL result sets are handled, but in five minutes you can write your transformer function for any type of database using the provided sample code in the gateway/lib/CabronRecordSet.php file. (a href="">eatti)