mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
coding standards
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@297477 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
f86f89b517
commit
3c5e32fa72
5 changed files with 18 additions and 23 deletions
|
@ -52,10 +52,10 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
if(is_float(27.25)) {
|
||||
echo "is float\n";
|
||||
}else {
|
||||
echo "is not float\n";
|
||||
if (is_float(27.25)) {
|
||||
echo "is float\n";
|
||||
} else {
|
||||
echo "is not float\n";
|
||||
}
|
||||
var_dump(is_float('abc'));
|
||||
var_dump(is_float(23));
|
||||
|
|
|
@ -54,9 +54,9 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
if (is_int(23)) {
|
||||
echo "is integer\n";
|
||||
echo "is integer\n";
|
||||
} else {
|
||||
echo "is not an integer\n";
|
||||
echo "is not an integer\n";
|
||||
}
|
||||
var_dump(is_int(23));
|
||||
var_dump(is_int("23"));
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$tests = Array(
|
||||
$tests = array(
|
||||
"42",
|
||||
1337,
|
||||
"1e4",
|
||||
|
@ -64,14 +64,10 @@ $tests = Array(
|
|||
9.1
|
||||
);
|
||||
|
||||
foreach($tests as $element)
|
||||
{
|
||||
if(is_numeric($element))
|
||||
{
|
||||
foreach ($tests as $element) {
|
||||
if (is_numeric($element)) {
|
||||
echo "'{$element}' is numeric", PHP_EOL;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "'{$element}' is NOT numeric", PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,20 +53,19 @@
|
|||
// array from our object
|
||||
function get_students($obj)
|
||||
{
|
||||
if(!is_object($obj))
|
||||
{
|
||||
return(false);
|
||||
if (!is_object($obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return($obj->students);
|
||||
return $obj->students;
|
||||
}
|
||||
|
||||
// Declare a new class instance and fill up
|
||||
// some values
|
||||
$obj = new stdClass;
|
||||
$obj->students = Array('Kalle', 'Ross', 'Felipe');
|
||||
$obj = new stdClass();
|
||||
$obj->students = array('Kalle', 'Ross', 'Felipe');
|
||||
|
||||
var_dump(get_students(NULL));
|
||||
var_dump(get_students(null));
|
||||
var_dump(get_students($obj));
|
||||
?>
|
||||
]]>
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
<![CDATA[
|
||||
<?php
|
||||
if (is_string("23")) {
|
||||
echo "is string\n";
|
||||
echo "is string\n";
|
||||
} else {
|
||||
echo "is not an string\n";
|
||||
echo "is not an string\n";
|
||||
}
|
||||
var_dump(is_string('abc'));
|
||||
var_dump(is_string("23"));
|
||||
|
|
Loading…
Reference in a new issue