您的位置 首页 php

javascript中的PHP数组


(1)PHP 字符串

一个字符串是一串字符的序列,就像 “Hello world!”。可以将任何文本放在单引号和双引号中。

代码:

<body>

<h1> 这是一个PHP页面 </h1>

<?php $x = “Hello world!” ; echo $x ; echo “<br>” ; $x = ‘Hello world!’ ; echo $x ; ?> </body>

效果:

(2)PHP 整型

整数是一个没有小数的数字。
整数规则:
整数必须至少有一个数字 (0-9)
整数不能包含逗号或空格
整数是没有小数点的
整数可以是正数或负数
整型可以用三种格式来指定:十进制, 十六进制( 以 0x 为前缀)或八进制(前缀为 0)。

代码:

<body>

<h1> 这是一个PHP页面 </h1>

<?php $x = 5985 ;

var_dump( $x ); echo “<br>” ; $x = – 345 ; // 负数

var_dump( $x ); echo “<br>” ; $x = 0x8C ; // 十六进制数

var_dump( $x ); echo “<br>” ; $x = 047 ; // 八进制数

var_dump( $x ); ?> </body>

效果:

(3)PHP 浮点型

浮点数是带小数部分的数字,或是指数形式。
在以下实例中我们将测试不同的数字。
PHP var_dump() 函数返回变量的数据类型和值。

代码:

<body>

<h1> 这是一个PHP页面 </h1>

<?php $x = 10.365 ;

var_dump( $x ); echo “<br>” ; $x = 2.4e3 ;

var_dump( $x ); echo “<br>” ; $x = 8E-5 ;

var_dump( $x ); ?> </body>

效果:

(4)PHP 数组

数组可以在一个变量中存储多个值。在以下实例中创建了一个数组, 然后使用 PHP var_dump() 函数返回数组的数据类型和值。

代码:

<body>

<h1> 这是一个PHP页面 </h1>

<?php $cars = array ( “Volvo” , “BMW” , “Toyota” );

var_dump( $cars ); ?> </body>

效果:

(5)PHP 对象

对象数据类型也可以用于存储数据。在 PHP 中,对象必须声明。
首先,必须使用class关键字声明类对象。类是可以包含属性和方法的结构。

代码:

<body>

<h1> 这是一个PHP页面 </h1>

<?php class Car {

var $color ;

function __construct ( $color = “green” ) {

$this ->color = $color ;

}

function what_color () {

return $this ->color;

}

} function print_vars ( $obj ) {

foreach (get_object_vars( $obj ) as $prop => $val ) {

echo “\t$prop = $val\n” ;

}

} // 实例一个对象 $herbie = new Car( “white” ); // 显示 herbie 属性 echo “\therbie: Properties\n” ;

print_vars( $herbie ); ?> </body>

效果:

(6)PHP NULL 值

NULL 值表示变量没有值。NULL 是数据类型为 NULL 的值。NULL 值指明一个变量是否为空值。 同样可用于数据空值和NULL值的区别。

代码:

<body>

<h1> 这是一个PHP页面 </h1>

<?php $x = “Hello world!” ; $x = null ;

var_dump( $x ); ?> </body>

文章来源:智云一二三科技

文章标题:javascript中的PHP数组

文章地址:https://www.zhihuclub.com/29971.shtml

关于作者: 智云科技

热门文章

评论已关闭

29条评论

  1. Despite research supporting the benefits and safety of upper body resistance exercise, many breast cancer survivors avoid strenuous arm activity because of inaccurate arm care advice, fear of lymphedema, and self efficacy regarding arm exercise Lee et al

  2. Our case and literature review underscore the importance of continued awareness, risk assessment, and prevention to reduce this potential fatal complication in patients with solid tumors I was started on Tomoxifen and became allergic to it and switched to Femara

  3. s sole product, may reach 1 This normal process in male growth and development does not require any type of testing

  4. And contrary perhaps to some of our beliefs, these hot flashes do not always wear off over time

  5. Screening a panel of KRAS mutant and wild type cell lines identifies genes broadly required by KRAS mutant cells

  6. Vintage depression, multiple egg fertilized with this spring with similar estrogen receptor The main adverse effects are listed in Table 54 5

  7. I think you can put on the weight you are looking for with test only, however you will lose 10lbs of water when you stop

  8. Kumari AS, Haq A, Jayasundaram R, Abdel Wareth LO, Al Haija SA, Alvares M The results of this study showed that breast cancer was common among young women in central Vietnam during the study period

  9. Current hyponatraemia guidelines are divided on the use of tolvaptan in hospitalised patients with moderate to severe hyponatraemia, due to an uncertain risk benefit ratio

  10. Retrospective analyses of patient samples HR ve n 348 confirmed that mBC patients with deleterious FAT1 mutations in their pretreatment biopsies MSK IMPACT had poorer clinical outcomes with CDK4 6 inhibition mPFS 2

  11. QTL that harbor variants that influence development of pyometritis were mapped to RNO5 in crosses between susceptible BN rats and resistant ACI and F344 rats 59, 112

  12. Z score Your Z score is your bone density versus what is considered normal bone density for someone your age, sex, ethnicity, height, and weight

  13. com 20 E2 AD 90 20Viagra 20Jakarta 20Pusat 20 20Viagra 20Review viagra review Гў A 4 year old Mississippi boy, whose name has not been released, also died in August after contracting the infection the month before while visiting the Violet, La

  14. Some variants may spread more easily than others or be more resistant to vaccines or treatments

  15. Twelve games later, the greatest returner in tennis was a point away from breaking his opponent for a fourth time, a remarkable achievement considering Nadal had won 81 of 82 service games heading into the final

网站地图