In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "weak type introduction of PHP string function". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "weak type introduction of PHP string function".
PHP string function weakly typed
PHP is a weakly typed language, so other types of data can generally be directly applied to string manipulation functions, and automatically converted to string types for processing, such as: echo substr ("1234567", 1,3); and echo substr (123456); the same definition usually uses double or single quotation marks to identify a string. such as
$str = "i love u"; $str ='I love u'
There are some differences between the other and the other. The latter treats all the contents of single quotes as characters; the former is not. such as
$test = "iwind"; $str = "I love $test"; $str1 ='I love $test'; echo $str; / / will get i love iwind echo $str1; / / will get I love $test
The behavior of the following two examples is also different:
Echo "i love test"; / / will get i love est, t has been regarded as escaped echo'i love test'; / / will get i love test
Thus it can be simply considered that the content in double quotes is "explained", and that single quotation marks are "WYSIWYG" (in particular, 'will be recognized as a''). Obviously, the form of double quotation marks is more flexible, of course, single quotation marks will be suitable for some special occasions, so I won't elaborate here. The most common output in the output PHP is echo,print. Neither is a real function, but a language construct, so you don't have to use double parentheses when calling (such as echo ("test"); print ("test")). In the output, both can be assigned: echo $str= "test"; on the one hand, output test, on the other hand, assign "test" to the string variable $strprint $str= "test"; there are other differences between the two except for their different names. Print has a return value, which always returns 1, but echo does not, so echo is faster than print:
$return = print "test"; echo $return; / / output 1
For this reason, print can be applied to compound statements, while echo cannot:
Isset ($str) or print "str variable not defined"; / / output "str variable undefined" isset ($str) or echo "str variable not defined"; / / prompt parsing error echo to output multiple strings at a time, while print cannot: echo "I", "love", "iwind"; / / output "i love iwind" print "I", "love", "iwind" / / will prompt error echo,print can also output a string called "document syntax", such as: echo
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.