PHP中的字符串操作功能是比较多的,重要的有以下这些:
(1)echo,print,printf,sprintf
前两个函数是输出字符串.字符串中如果有变量名则被替换成其值. 后两个函数类似于C的同名函数.
(2)strchr,strlen,strtok,strrchr,strrev,strstr,strtolower, strtoupper,substr,ucfirst
这些是常用的字符串操作函数,有些和C中的同名函数意义完全一致.
strrev是把一个字符串翻转.
strtolower和strtoupper的意思应该不用解释了.
ucfirst是把字符串的第一个字符变成大写.
substr是返回字符串的一个子串,用法是:substr(字符串,头,长度).
头位置是 从0算起的.如果是负数,则是从尾部向前数的意思.
(3)Chr,Ord
类似于C的同名函数.
(4)explode,implode,join
这些是和数组有关的函数.
explode(字符串,分割符)返回一个将字符串在分割符处分开所产生的数组.
implode(数组,分割符)返回一个将数组各元素之间插上分割符而成的字符串.
join与implode意义相同.
(5)Chop
去掉字符串尾部的空白.
(6)htmlspecialchars
将字符串中的HTML特殊字符换成它们的名字,例如"< "变成"<".
(7)nl2br
在字符串中的每一个回车前面加上"< BR>".
(8)AddSlashes,StripSlashes
分别给字符串中需要加上""才能用于数据库查询的字符加上和去掉"".
(9)parse_str
将"name1=value1&name2=value2&..."类型的字符串分析成一些变量.
例如:
parse_str("a=1&b=2");
生成$a与$b两个变量,值分别为1,2. 如果有两对名字/值的名字部分相同,则后一个的值覆盖前一个的. 如果这两对的名字尾部都有"",例如"a=1&a=2",则生成数组$a,两个元素分别为1,2
(1)echo,print,printf,sprintf
前两个函数是输出字符串.字符串中如果有变量名则被替换成其值. 后两个函数类似于C的同名函数.
(2)strchr,strlen,strtok,strrchr,strrev,strstr,strtolower, strtoupper,substr,ucfirst
这些是常用的字符串操作函数,有些和C中的同名函数意义完全一致.
strrev是把一个字符串翻转.
strtolower和strtoupper的意思应该不用解释了.
ucfirst是把字符串的第一个字符变成大写.
substr是返回字符串的一个子串,用法是:substr(字符串,头,长度).
头位置是 从0算起的.如果是负数,则是从尾部向前数的意思.
(3)Chr,Ord
类似于C的同名函数.
(4)explode,implode,join
这些是和数组有关的函数.
explode(字符串,分割符)返回一个将字符串在分割符处分开所产生的数组.
implode(数组,分割符)返回一个将数组各元素之间插上分割符而成的字符串.
join与implode意义相同.
(5)Chop
去掉字符串尾部的空白.
(6)htmlspecialchars
将字符串中的HTML特殊字符换成它们的名字,例如"< "变成"<".
(7)nl2br
在字符串中的每一个回车前面加上"< BR>".
(8)AddSlashes,StripSlashes
分别给字符串中需要加上""才能用于数据库查询的字符加上和去掉"".
(9)parse_str
将"name1=value1&name2=value2&..."类型的字符串分析成一些变量.
例如:
parse_str("a=1&b=2");
生成$a与$b两个变量,值分别为1,2. 如果有两对名字/值的名字部分相同,则后一个的值覆盖前一个的. 如果这两对的名字尾部都有"",例如"a=1&a=2",则生成数组$a,两个元素分别为1,2
xujie333
2012-5-21 14:43
coach outlet online Store guarantee that all the coach handbags offered are own high quality. In addition , all of them are sold at an unexpected low price.If you want to purchase, just visit their website.coach factory outlet is really sizzling kinds of shopping way for you. With the usage of the replica designer coach bags, you can surely be able to change your individual looks in a stunning manner.Coach bags on sale from the coach outlet are cheap or discount prices that you certainly will stand out from the crowd on your next camping trip!<br/>
coach88888888
2012-8-13 17:28
Coach Factory Outlet offer excellent, elegant coach products in order to generate room for your new collections.They're purchased more quickly that you may at any time imagine.Most significantly, the coach designer purses of Coach Factory Online industry won't deteriorate your individual fashions at all. Rather they would immediately change your overall looks marvelously.I find it all very odd But this is no different than Coach Outlet Online any other company that has an outlet presence and really doesn’Coach Outlet Store t explain it to the customer.By the fashion, novel appearance, sophisticated technology, superior quality, Coach Outlet won domestic and international customers, their products exported to the Middle East, Southeast Asia and other regions.
baozang
2012-9-22 13:34
Lamo - Like Sebago, Louis Vuitton Canada there are only about 40 styles of Lamo Footwear. Most of their footwear uses a suede leather traditional in True Religion Jeans moccasins, though only about 1/3 of the footwear collection is a traditional moccasin look. True Religion Brand Jeans The rest of the collection is slippers and UGG styled boots.Louis Vuitton Artsy The traditional moccasins do have a soft rubber sole making them great deck True Religion Sale shoes as well, however. Expect to pay between $50 and $60 for Lamo moccasins. Invicta watches have been here since 1837. They were made by Raphael Picard. Invicta watches got its name from a Latin word. The meaning of Invicta in Louis Vuitton Monogram Vernis Alma BB Amarante Latin is "Invincible". Earlier these watches were not so popular but recently with its new men's collection this watch brand has gained a lot of popularity. Watches for many are a style statement and so they prefer to own the best piece. Invicta watches are popular as they are like a style statement.
fhgh
2012-9-27 08:57
The specific resources that are Karen Millen dresses utilized for developing these outside jackets are on the most effective as well as the most significant best quality. The climate resistant resources aid to create your coat a instead beneficial factor, which you'll have the ability to place on all through at any time in the day.Barbour coats are possibly probably the most trendy design equipment, which you merely can not overlook to buy. Consequently, Karen Millen dress within the occasion you swear via the existing design tendencies then it is ideal to positively choose an superb top quality coat produced by this model. It is feasible to place on these leather-based coats with Karen Millen Ireland slim pants or chinos and also an normal trouser. concerning comfort and design, these outside jackets are top the charts. The amazing designs and sorts from, which you might purchase these outside jackets, are provided in countless distinct colors.
shz
2022-7-2 18:58
Very awesome!!! When I seek for this I found this website at the top of all blogs in search engine. Lead generation
shz
2022-7-2 19:02
You completely match our expectation and the variety of our information. Lead generation
shz
2022-7-2 19:06
Wonderful blog post. This is absolute magic from you! I have never seen a more wonderful post than this one. You've really made my day today with this. I hope you keep this up! Lead generation
shz
2022-7-2 19:10
This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. Lead generation
shz
2022-7-2 19:12
this blog was really great, never seen a great blog like this before. i think im gonna share this to my friends.. Lead generation
shz
2022-7-2 19:16
Thanks for the best blog. it was very useful for me.keep sharing such ideas in the future as well. Lead generation
shz
2022-7-2 19:19
This is a splendid website! I"m extremely content with the remarks!. Lead generation
shz
2022-7-2 19:23
Cool you write, the information is very good and interesting, I'll give you a link to my site. Lead generation
shz
2022-7-2 19:27
Thumbs up guys your doing a really good job. Lead generation
shz
2022-7-2 19:31
I have read your excellent post. This is a great job. I have enjoyed reading your post first time. I want to say thanks for this post. Thank you... Lead generation
안전놀이터
2022-12-5 15:56
I came here after searching for 안전놀이터 to spend my time more efficiently after work. The content is not burdensome and the writing is easy to understand. Thank you so much for being able to spend meaningful time after work.
herrylauu
2023-8-14 10:37
very good and meaningful article, i have learned a few more things. Also, if you have time, please stop by stumble guys for relaxing moments stumble guys
Seth
2023-12-17 15:47
When visiting blogs, i usually discover a very good content like yours Facboook
Lucky cola
2024-2-7 16:44
More than a platform - it's a gaming revolution. Lucky cola
gemmalyly
2024-5-24 11:08
While bandle offers plenty of opportunities for exploration and adventure, it also requires careful planning and strategic thinking.
分页: 2/2 1 2