What is the best practice for including PHP files in Flash?

When including PHP files in Flash, the best practice is to use ActionScript's URLRequest and URLLoader classes to load the PHP file and retrieve its content. This allows for seamless communication between Flash and PHP, ensuring that data can be passed back and forth effectively.

<?php
// sample PHP file (example.php)
$data = array("name" => "John", "age" => 30);
echo json_encode($data);
?>