mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Fixing example code to comply with PEAR coding standards.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@267321 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
193329c660
commit
0db3f7cb2c
10 changed files with 29 additions and 29 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.chgrp">
|
||||
<refnamediv>
|
||||
<refname>chgrp</refname>
|
||||
|
@ -63,9 +63,10 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
$filename = 'shared_file.txt';
|
||||
echo("$filename's Group ID @ " . time() . ": " . filegroup($filename) . "\n");
|
||||
$format = "%s's Group ID @ %s: %d\n";
|
||||
printf($format, $filename, date('r'), filegroup($filename));
|
||||
chgrp($filename, 8);
|
||||
echo("$filename's Group ID @ " . time() . ": " . filegroup($filename) . "\n");
|
||||
printf($format, $filename, date('r'), filegroup($filename));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.clearstatcache">
|
||||
<refnamediv>
|
||||
<refname>clearstatcache</refname>
|
||||
|
@ -85,13 +85,15 @@ function get_owner($file)
|
|||
return $user['name'];
|
||||
}
|
||||
|
||||
echo('UID @ ' . date('r') . ': ' . get_owner($file) . PHP_EOL);
|
||||
$format = "UID @ %s: %s\n";
|
||||
|
||||
printf($format, date('r'), get_owner($file));
|
||||
|
||||
chown($path, 'ross');
|
||||
echo('UID @ ' . date('r') . ': ' . get_owner($file) . PHP_EOL);
|
||||
printf($format, date('r'), get_owner($file));
|
||||
|
||||
clearstatcache();
|
||||
echo('UID @ ' . date('r') . ': ' . get_owner($file) . PHP_EOL);
|
||||
printf($format, date('r'), get_owner($file));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.fgetss">
|
||||
<refnamediv>
|
||||
<refname>fgetss</refname>
|
||||
|
@ -110,9 +110,8 @@ EOD;
|
|||
file_put_contents('sample.php', $str);
|
||||
|
||||
$handle = @fopen("sample.php", "r");
|
||||
if($handle) {
|
||||
while(!feof($handle))
|
||||
{
|
||||
if ($handle) {
|
||||
while (!feof($handle)) {
|
||||
$buffer = fgetss($handle, 4096);
|
||||
echo $buffer;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<!-- $Revision: 1.10 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.fileinode">
|
||||
<refnamediv>
|
||||
<refname>fileinode</refname>
|
||||
|
@ -49,9 +49,8 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
$filename = 'index.php';
|
||||
if(getmyinode() == fileinode($filename))
|
||||
{
|
||||
echo('You are checking the current file.');
|
||||
if (getmyinode() == fileinode($filename)) {
|
||||
echo 'You are checking the current file.';
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<!-- $Revision: 1.15 $ -->
|
||||
<!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.14 -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.ftruncate">
|
||||
<refnamediv>
|
||||
|
@ -105,7 +105,7 @@ $filename = 'lorem_ipsum.txt';
|
|||
$handle = fopen($filename, 'r+');
|
||||
ftruncate($handle, rand(1, filesize($filename)));
|
||||
rewind($handle);
|
||||
echo(fread($handle, filesize($filename)));
|
||||
echo fread($handle, filesize($filename));
|
||||
fclose($handle);
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.link">
|
||||
<refnamediv>
|
||||
<refname>link</refname>
|
||||
|
@ -58,8 +58,8 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$source = "source.ext"; // This is the file that already exists
|
||||
$dest = "newfile.ext"; // This the filename that you want to link it to
|
||||
$source = 'source.ext'; // This is the file that already exists
|
||||
$dest = 'newfile.ext'; // This the filename that you want to link it to
|
||||
|
||||
link($source, $dest);
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.8 $ -->
|
||||
<!-- $Revision: 1.9 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.pclose">
|
||||
<refnamediv>
|
||||
<refname>pclose</refname>
|
||||
|
@ -49,7 +49,7 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$handle = popen("/bin/ls", "r");
|
||||
$handle = popen('/bin/ls', 'r');
|
||||
pclose($handle);
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.11 $ -->
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.readfile">
|
||||
<refnamediv>
|
||||
<refname>readfile</refname>
|
||||
|
@ -72,7 +72,7 @@
|
|||
<?php
|
||||
$file = 'monkey.gif';
|
||||
|
||||
if(file_exists($file)) {
|
||||
if (file_exists($file)) {
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename='.basename($file));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.12 $ -->
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.rewind">
|
||||
<refnamediv>
|
||||
<refname>rewind</refname>
|
||||
|
@ -64,7 +64,7 @@ rewind($handle);
|
|||
fwrite($handle, 'Foo');
|
||||
rewind($handle);
|
||||
|
||||
echo(fread($handle, filesize('output.txt')));
|
||||
echo fread($handle, filesize('output.txt'));
|
||||
|
||||
fclose($handle);
|
||||
?>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.13 $ -->
|
||||
<!-- $Revision: 1.14 $ -->
|
||||
<refentry xmlns="http://docbook.org/ns/docbook" xml:id="function.rmdir">
|
||||
<refnamediv>
|
||||
<refname>rmdir</refname>
|
||||
|
@ -83,8 +83,7 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if(!is_dir('examples'))
|
||||
{
|
||||
if (!is_dir('examples')) {
|
||||
mkdir('examples');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue