PHP語法:echo、static、換行
PHP,一個嵌套的縮寫名稱,是英文超級文本預處理語言(PHP:Hypertext Preprocessor)的縮寫。PHP 是一種 HTML 內嵌式的語言,PHP與微軟的ASP頗有幾分相似,都是一種在服務器端執行的嵌入HTML文檔的腳本語言,語言的`風格有類似於C語言,現在被很多的網站編程人員廣泛的運用。
PHP語法:echo、static、換行一、echo,輸出和換行
舉例:echo "string"
現在我想換行再輸入,我寫代碼如下,我感覺程序會換行
可惜,程序不懂金陽光
其實PHP有換行符echo "
";
二、static 靜態修飾符
爲什麼程序變量需要什麼static呢?我們先看一段代碼
金陽光本意是想不斷調用testStatic函數,讓變量$x不斷自增1,不斷調用輸出,結果爲x=1;x=2 x=3 ...
可惜事與願違!,這裏static可以大顯身手
加上一個static修飾符
搞定了。這裏給大家講點原理:
通常,當函數完成/執行後,php會刪除所有變量,這時候我們希望保留原來變量運算值,除了用全局變量,還可以用static,因爲static生命週期很長很長,一直到整個程序退出才釋放,所以申明爲static的話,x過程中運算,包括函數退出值還可以保存。
相關文章
-
The Best Thing That Could Ever Happen少兒雙語閱讀
Unit 3 The Best Thing That Could Ever Happen單元 3 最棒的事Three old men were sitting around and talking.三個老頭坐在一起聊天。The 80-year-old remarked, "The best thing that could happen to me would j -
少兒英語小故事:She Practices Flips for the Olympic
She does handstands. She does cartwheels. She does flips. She does back flips and front flips. She does somersaults. She trains every day. She is a gymnast. She practices for the Olympics. The Olympic -
英語四級作文The Importance of Physical Exercise
The Importance of Physical ExerciseEveryone hopes to live happily in the world. Physical exercise is indispensable to a happy life. There is a famous saying:Life lies on exercise. Although you will no -
The relationship between theory and practice大學英語作文
We all know that books are a source of there are those who think what the book contains must be is stupid to follow the books without any the old saying goes,to believe everything in books is worse -
C語言關鍵字:auto、static、register、const
程序是由一個一個的語句組成的,下面本站小編就爲大家總結一下C語言關鍵字:auto、static、register、const、volatile 、exte ,希望對您有所幫助! auto這個這個關鍵字用於聲明變量的生存期爲自動,即將不在任何類、結構 -
Compare with the domestic hen and the duck英語作文
The domestic hen and the duck both belong to the bird category. They have some features in common such as wings, feet, beak, flight, nest, migration, food and eggs.The domestic hen has short wings whi -
Keeping Healthy Topic2 Section C教案教學反思
仁愛版八年級上Unit 2 Keeping Healthy Topic 2I must ask him to give up ion C 教學設計The main activities are1aand2a. 本課重點活動是1a和2a。Ⅰ. Teaching aims and demands 教學目標1. Lea some new words an -
關於Adobe爲iPad版Photoshop Touch加入壓敏觸控筆支持
Adobe今日發佈了iPad版Photoshop Touch更新,加入了對壓敏觸控筆的支持,此外新版Photoshop Touch還專門爲iPad mini屏幕進行了優化。Photoshop Touch還加入了對社交網站的支持。現在用戶可以使用Pogo Connect、Jot Touch -
英語四級聽力訓練: this is the Technology Report
From Leaing English, this is the Technology Report.European airplane maker Airbus plans to have new passenger airplanes by the end of the year. The new models will use some of the most mode technologi -
PPT職稱考試“Shockwave Flash Object”控件法
導語:Flash動畫閃在PowerPoint2003中的四種方法你知道是什麼嗎?本站小編已經整理出來了,需要學習的小夥伴們一起來看看吧。Flash是大名鼎鼎的美國Macromedia公司推出的一款優秀的矢量動畫製作軟件,它簡單易學,功能強大,能