モバイル デバイスで動作する PHP ドキュメントを作成しようとしています。ナビゲーション用にアプリの上部にボタンを表示する JavaScript があります。私のphpドキュメントは、ボタンのすぐ下に表示されるはずです。かなり単純なページのはずですが、かなり苦労しています。変数を設定する関数を単純に呼び出そうとしています。この変数を使用して、アプリを使用している人が持っている金額を表示したいと考えています。関数と変数で問題が発生しています。HTML では変数や関数を使用できないと言われたので、php に侵入して "echo functionName();" を使用する必要があるため、関数を宣言し、関数を呼び出して変数を設定し、div 内のページに変数を表示します。私のコードは次のとおりです。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<?php
?>
<html>
<head>
    <script type="text/javascript">
    //int $availableBal;
    //int $currentHoldings;
    function int getBalance();
    {
        int $availableBal = 500;
        //alert("you have " + $availableBal + " dollars to spend");
        return $availableBal;
    }
    function void getHoldings()
    {
        int $MSFT_Shares = 5;
        int $MFST_Price= 100;
        int $currentHoldings = $MSFT_Shares * $MSFT_Price;
        return $currentHoldings;
    }
    </script>   
    <style>
html {text-align:center}
</style>
</head>
<body>
    <div id="totalMoney" align="center" style= "border:1px solid grey">         
            You have a current balance of: $ <?php 'echo getBalance();' ?> 
            <br>
            <!--The total worth of your current stocks is: $ <script type="text/javascript"> document.write(getHoldings();)</script> -->
    </div>
</body>
</html>