您的位置 首页 php

重新学习php基础之数据类型–字符串(三)

重新学习php基础之数据类型--字符串(三)

php虽然是弱语言,但是它也有自己的数据类型。php数据类型可分为七种:

  • String(字符串类型)
  • Boolearn(布尔型)
  • Array(数组型)
  • Integer(整型)
  • Float(浮点型)
  • Object(对象类型)
  • Null(空值)

1、PHP字符串

字符串是用双引号或单引号给变量加上的一个变量。字符串是php主要的数据结构

 <?php
$text = 'hello world'; 
echo $text;
 ?>  

如何把两个字符串连接起来?

用’ . ‘连接符把两个字符串连接起来,如下:

 <?php
$a = 'hello world'; 
$b ='welcome to china';
echo $a ." " .$b;
 ?>  

php字符串内置函数有很多,主要学习查询、截取、替换、添加、删除常用的几个:

  • strlen() 返回字符串的长度
  • strpos() 函数用于在字符串内查找一个字符或一段指定的文本
  • chr() 移除字符串右侧的空白字符或其他字符
  • trim () 移除字符串两侧的空白字符和其他字符
  • ucfirst() 把字符串中的首字符转换为大写
  • ucwords() 把字符串中每个单词的首字符转换为大写
  • substr() 返回字符串的一部分
  • strtolower() 把字符串转换为小写字母
  • strtoupper() 把字符串转换为大写字母
  • strrev() 反转字符串
  • strip_tags() 剥去字符串中的 HTML 和 PHP 标签
  • str_word_count() 计算字符串中的单词数
  • strcasecmp() 比较两个字符串
  • strchr() 查找字符串在另一字符串中的第一次出现
  • substr_replace() 把字符串的一部分替换为另一个字符串
 <?php
 echo strlen('hello world');  //获取字符串的长度
 echo strpos('hello world','world'); //查询world在hello world的位置 ,会输出6
?>  

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

文章标题:重新学习php基础之数据类型–字符串(三)

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

关于作者: 智云科技

热门文章

评论已关闭

42条评论

  1. Tadalafil Oral Strips are based on the Tadalafil 20 mg, the active component that provides the 36 hours effect Long-term low-dose tadalafil is one of the first-line treatments for repairing damaged vascular endothelium and promoting long-term improvement of erectile function 32

  2. Some insurance companies will cover generic ED medications, but not brand-name pills; others do the opposite

  3. Healthy male elderly subjects 65 years or over had a lower oral clearance of tadalafil, resulting in 25 higher exposure AUC with no effect on Cmax relative to that observed in healthy subjects 19 to 45 years of age

  4. Austin Fertility Reproductive Medicine Westlake IVF, 300 Beardsley Lane, Building B, Suite 200, Austin, TX, 78746, USA.

  5. PLK1 phosphorylates cyclin B in centrosomes leading to nuclear accumulation of p cyclin B1 during prophase

  6. 2, asterisks, it was not as pronounced as that already observed in the presence of NADP and citrate MgCl 2

  7. 10, 11, 12, 13 Three large studies have recently presented a more comprehensive examination of the multi omic landscape of ILC, providing power to tease out alterations enriched in ILC relative to IC NST

  8. However, with some simple lifestyle changes you can help to reduce the impact and live better

  9. My nipples have been feeling itchy and looked a little more puffy these past few months, which is one of the reasons I m quitting the drug

  10. desmopressin salbutamol albuterol dosage We are OK on the breadth at the moment, there is enoughstrength within the market for it to turn round, said BillRook, technical analyst at Redmayne Bentley

  11. Гў Where that really comes into play is the key capability of interoperability between various terminals and war fighters, Гў he said

  12. The Ifi202a and Ifi202b are highly homologous murine genes that encode p202a and p202b proteins, respectively 26, 27

  13. I actually have this weird patch of skin on my hip and I think I m going to mention it to my MO the next office visit

  14. Sarisky RT, Bacon TH, Boon RJ, Duffy KE, Esser KM, Leary J, Locke LA, Nguyen TT, Quail MR, Saltzman R Isabella djhwCzSxAnGywI 6 20 2022

  15. Complete differential HDX perturbation map of D538G ERО± LBD with E2 Male infertility is a term applied when the male partner is identified to be the source of infertility

  16. These results show that the odor of newborns undoubtedly plays a role in the development of motivational and emotional responses between mother and child by eliciting maternal care functions such as breastfeeding and protection, Гў

  17. 01 for acne Sainsbury s complained to the ASA over the campaign, which launched earlier this year, claiming that it was impossible to compare certain own brand items Houserman is very realistic, without being overly blunt

  18. PГ©rez Gallego L These data suggest that MPA causes a hypercoagulable state and that any change must be carefully monitored during treatment with either MPA or tamoxifen

  19. Conjugated linoleic acid supplementation in humans effects on circulating leptin concentrations and appetite ACE inhibitor allergies

  20. B Four way Venn diagrams of WT Fe versus KO Fe Cre islets during 6 mM versus 1 8mM glucose exposur e for 72 h

  21. Monitor Closely 1 fluconazole will increase the level or effect of tolterodine by affecting hepatic intestinal enzyme CYP3A4 metabolism The relationship between green tea and total caffeine intake and risk for self reported type 2 diabetes among Japanese adults

  22. Additionally, the fluid filled systems can develop air bubbles, resulting in false ICP values Mechanically most stable state of TAX bound talin talin with 40 ОјM TMX shows the lowest binding energy and the least stable state talin with 100 1ОјM TMX shows the highest binding energy indicating the role of hydrophobicity in protein stability

  23. We deleted the TBR2 type 2 TGF ОІ receptor in SMC of 11 month old mice genotype Acta2 CreER T2 0 Tgfbr2 f f, termed TBR2 SMО” and compared their ascending aorta structure and vasomotor function to controls Acta2 CreER T20 0 Tgfbr2 f f, termed TBR2 f f

  24. Primary antibodies used in this study are ER 6F11 from Abcam, Cambridge, MA, USA; PR sc 7208 and BCL2 sc 509 from Santa Cruz Biotechnology, Santa Cruz, CA, USA; P AKT Thr308 2214 and P AKT Ser473 2118 from Epitomics, Burlingame, CA, USA; P PRAS40 Thr246 2997, P GSK3 Ser9 9323, P ERK1 2 Thr202 Tyr204 9101, P S6 Ser240 244 2211, P 4EBP1 Thr37 46 9459, P mTOR Ser2448 2971, AKT 9272, ERK1 2 9102, GSK 3ОІ 9832, PTEN 9559, ОІ actin 4970, and c PARP 9541 from Cell Signaling Technology, Danvers, MA, USA

  25. The most effective and popular vasodilator therapy continues to be the calcium channel blockers e

  26. The DSM 5 included other specifiers that can accompany a manic episode, such as anxious distress, rapid cycling, mood congruent or mood incongruent psychotic features, catatonia, peripartum onset, and seasonal pattern

  27. Shock can be caused by any pathological process that leads to intravascular volume loss, pathological vasodilatation, myocardial dysfunction or obstruction of either venous return as occurs in severe asthma or ventricular outflow Blood urea nitrogen BUN level b

  28. If that is the case, why do not you take out the Nebula Ruler as soon as possible PK endpoints of steady state oral semaglutide a and SNAC b either administered alone or after co administration with five oral placebo tablets

网站地图