Added {braces} and php tags to the examples.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@129442 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2003-05-30 18:07:51 +00:00
parent 1b0f444c3a
commit 17fdae93ba

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/array.xml, last change in rev 1.56 -->
<refentry id="function.in-array">
<refnamediv>
@ -42,6 +42,7 @@
<title><function>in_array</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)) {
print "Got Irix";
@ -49,6 +50,7 @@ if (in_array ("Irix", $os)) {
if (in_array ("mac", $os)) {
print "Got mac";
}
?>
]]>
</programlisting>
<para>
@ -70,10 +72,13 @@ Got Irix
<?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, TRUE))
if (in_array('12.4', $a, TRUE)) {
echo "'12.4' found with strict check\n";
if (in_array(1.13, $a, TRUE))
}
if (in_array(1.13, $a, TRUE)) {
echo "1.13 found with strict check\n";
}
?>
]]>
</programlisting>
@ -95,18 +100,23 @@ if (in_array(1.13, $a, TRUE))
<?php
$a = array(array('p', 'h'), array('p', 'r'), 'o');
if (in_array(array ('p', 'h'), $a))
if (in_array(array ('p', 'h'), $a)) {
echo "'ph' was found\n";
if (in_array(array ('f', 'i'), $a))
}
if (in_array(array ('f', 'i'), $a)) {
echo "'fi' was found\n";
if (in_array('o', $a))
}
if (in_array('o', $a)) {
echo "'o' was found\n";
}
/* Outputs:
'ph' was found
'o' was found
*/
?>
// This will output:
'ph' was found
'o' was found
]]>
</programlisting>
</example>