Discover mindstorm programming app, include the articles, news, trends, analysis and practical advice about mindstorm programming app on alibabacloud.com
function definition and invocation method
PHP函数的定义方式: 1.使用关键字“function”开始2.函数名可以是字母或下划线开头:functionname()3.在大括号中编写函数体: functionname(){ //函数体 echo 'Eric'; } 调用方法为函数名+参数,例如:name();
function that returns a valueUse the return keyword to return a value to a function that returns any type that includes an array and an object, or NULL if the return is omitted.
functionsum($a, $b) {return$a+$b;}//在这里调用函数取得返回值/** * 初始化数组函数 */functioninitArray(){$arr = ar
' , ' u ' =>); if (isset ( $arr )) {foreach ( $arr As $key => $value ) {echo $value . ; }}?>
SummarizeThe PHP array is divided into indexed array associative arrays
An associative array is an array of key values that are stringsExample of a foreach example in the previous example.php$arr = array( ‘wo‘=>"我", ‘love‘=>‘爱‘, ‘li‘=>‘莉‘ ); if(isset($arr)) { foreach($arr as $key=>$value) { print_r($value); //echo $val
Mobile app interface programming technology-Learning and implementation-PHP advanced array
Array creation and initialization
'Dashboard ', '2' => 'Old three', '1' => 'dashboard '); if (isset ($ arr3 )) {print_r ($ arr3) ;}?>
Use the array value
Print the data of the array
// Access through index directly
';}?>
// Use foreach to loop the values in the number Group
"I", 'love' => 'love', 'u' => '
Php programming app interface (2)-PHP generates XML data and adds the method xml () to the Reponse. php file ();
Public static function xml () {header ('content-type: text/XML'); $ xml ="
\ N "; $ xml. ="
\ N "; $ xml. ="
200\ N "; $ xml. ="
Data returned successfully
\ N "; $ xml. ="
\ N "; $ xml. ="
1
\ N "; $ xml. ="
Singwa
\ N "; $ xml. ="\ N "; $ xml. ="
"; E
Single quotes, double quotes
In PHP, the definition of a string can use single quotation marks ", or you can use double quotation marks" ". However, PHP allows us to include string variables directly in a double-quote string. The contents of a single quote string are always considered ordinary characters.
$str='hello';echo"str is $str"; //运行结果: str is helloecho'str is $str'$str
Connection of strings
In PHP, use the English dot. To connect two strings.
$i='I';$love=' Love
();$car//调用不存在的方法会使用重载echo$car->speed;
Class object Comparison
Object comparison, when all the properties of two instances of the same class are equal, you can use the comparison operator "= =" to determine whether the two variable is a reference to the same object, you can use the congruent operator "= = =" to judge.
classCar {}$anew Car();$bnew Car();if ($a$becho'=='; //trueif ($a$becho'==='//false
Object replication, in some special cases, you can copy an object by using the keywo
' =>); if (isset ( $arr )) {foreach ( $arr As $key => $value ) {echo $value . ; }}?>
SummarizeThe PHP array is divided into indexed array associative arrays
An associative array is an array of key values that are stringsFor example, an example of foreach in the previous example. $arr = array ( ' wo ' => ' love ' => ' AI ' , => ' Liz ' ); if (isset ( $arr )) {foreach ( $arr As $key => $value ) {Print_r ( $value ); //echo $val
name. GetcomponentOnclick.addlistener (); Add event (the method name of the event);Formula: this. Getcomponentonclickbut);_homel.onclick.addlistener (onclickbut); _menu.onclick.addlistener (Onclickmut); _jia.onclick.addlistener (onclickads);_jian.onclick.addlistener (Onclickjian);The text initialization assignment under this component._fenshu.text= "0";}public void onclickbut()// method of event{Instantiate (_camera);//Create an ObjectDestroy (_destroy);//Destroy his own}//ui switching over t
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.