有什么作用。(点)在 PHP 中做什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6484968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What does a . (dot) do in PHP?
提问by John Tor
What does the following command do in PHP?
以下命令在 PHP 中的作用是什么?
. $string // ($string is something which i declared in the program)
回答by Oliver Charlesworth
On its own, that does nothing at all (it's not valid syntax). However, if you have something like this:
就其本身而言,它什么都不做(它不是有效的语法)。但是,如果你有这样的事情:
<?php
$string1 = "Hello ";
$string2 = "world!";
$string = $string1 . $string2;
echo $string;
?>
You will see Hello world!
. The .
is the string concatenation operator.
你会看到Hello world!
。该.
是字符串连接运算符。
回答by phihag
Taken alone, this is a syntax error. The dot .
is the concatenation operatorthat converts its arguments to strings and concatenates them. For example,
单独来看,这是一个语法错误。点.
是连接运算符,它将其参数转换为字符串并将它们连接起来。例如,
<?php
$string = "x";
$s = 42 . $string;
// $s is now "42x"
回答by jjwdesign
Your statement would throw back an error.
你的语句会抛出一个错误。
The "dot" is a string concatenator. That is, it helps you to combine strings together into another string.
“点”是一个字符串连接器。也就是说,它可以帮助您将字符串组合成另一个字符串。
Example. $full = $part1 . $part2;
例子。$full = $part1 。$part2;
Concerning getting started: That's a difficult question. PHP.NET will be your functional looking site. Google-ing just about anything on PHP will direct you there. I'd look at getting a localhost setup of PHP/MySQL/Apache. If you're on a Windows machine, you can get a WAMP server setup.
关于入门:这是一个很难的问题。PHP.NET 将成为您功能齐全的网站。谷歌搜索几乎所有关于 PHP 的东西都会指引你到达那里。我会考虑获取 PHP/MySQL/Apache 的本地主机设置。如果您使用的是 Windows 计算机,则可以获得 WAMP 服务器设置。
This will drastically speed up your development and testing time. Don't try to FTP everything up to a Web server, as this approach will waste away 10-15% of your working time. Work smart - work local.
这将大大加快您的开发和测试时间。不要尝试通过 FTP 将所有内容上传到 Web 服务器,因为这种方法会浪费 10-15% 的工作时间。聪明地工作 - 在本地工作。
Find an existing project (Open Source) with a great community and just try to start something. For example, I recently created DogFriendlyOlrando.com based on WordPress. I was curious as to the abilities of WordPress. It was a fun little project and gave me a good understanding of WordPress' capabilities. You'll learn the most from just diving in and doing. Good luck!
找到一个拥有优秀社区的现有项目(开源),然后尝试开始一些事情。例如,我最近创建了基于 WordPress 的 DogFriendlyOlrando.com。我很好奇 WordPress 的能力。这是一个有趣的小项目,让我对 WordPress 的功能有了很好的了解。你会从潜入和实践中学到最多。祝你好运!
回答by Devid Piterson
The output is displayed directly to the browser like as a given below
输出直接显示到浏览器,如下所示
. $string // ($string is something which i declared in the program)