How to call a PHP function from Javascript

Accessing PHP function using Javascript
<?php
    function PHPFunction()
    {
        $str = "I am a PHP function";
        return $str;
    }
?>

<script>
    var Xmsg = '<?php $Xmsg = PHPFunction(); echo "$Xmsg" ?>';
    document.write(Xmsg);
</script>

Comments

Popular posts from this blog

How to use single or multi dimention arrays in PHP