echo
print
print()
1
,
echo
. :<br>
($success) ? echo '!': echo '...';
print
. PHP
echo ($success) ? '!' : '...';.
echo
- . , : «echo» — , , «print» — , .
echo
.
print
? —
echo
!echo
, -print
)'
) ("
). .echo "Hello, $name!";
), (echo "Hello\nworld!";
) (echo "${config['hello']}, ${position}th world!";
).echo
:echo string $arg1 [, string $...] )
, . .echo 'Hello,' , 'world!';
echo 'Hello,' . 'world!';
. , : . , Wouter Demuynck, (, ).
echo <<<HEREDOC<br>
Hello,<br>
world,<br>
I love you!<br>
HEREDOC;<br>
define('N',PHP_EOL); echo 'foo' . N;
echo "foo\n";<br>
echo 'foo' . "\n";
, .header()
.
functions.php:<br>
<php<br>
function foo()<br>
{<br>
...<br>
}<br>
function bar()<br>
{<br>
...<br>
}<br>
readfile
output. , — .require
, «! !» .include
warning, . — require .
include
require
«_once»:
include_once; require_once<
. , ? .
require_once
, .
file_put_contents('filename','data');
// File put contents
if (!defined('FILE_APPEND')) define('FILE_APPEND',1);
if (!function_exists('file_put_contents'))
{
function file_put_contents($n, $d, $flag = false) {
$mode = ($flag == FILE_APPEND || strtoupper($flag) == 'FILE_APPEND') ? 'a' : 'w';
$f = @fopen($n, $mode);
if ($f === false) {
return 0;
} else {
if (is_array($d)) $d = implode($d);
$bytes_written = fwrite($f, $d);
fclose($f);
return $bytes_written;
}
}
}
Source: https://habr.com/ru/post/11380/
All Articles