<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=PHP%2FFunctions%2FDefinition</id>
		<title>PHP/Functions/Definition - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://wbex.ru/index.php?action=history&amp;feed=atom&amp;title=PHP%2FFunctions%2FDefinition"/>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Functions/Definition&amp;action=history"/>
		<updated>2026-04-05T02:43:35Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wbex.ru/index.php?title=PHP/Functions/Definition&amp;diff=698&amp;oldid=prev</id>
		<title> в 10:37, 26 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Functions/Definition&amp;diff=698&amp;oldid=prev"/>
				<updated>2010-05-26T10:37:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 10:37, 26 мая 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
			</entry>

	<entry>
		<id>http://wbex.ru/index.php?title=PHP/Functions/Definition&amp;diff=699&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://wbex.ru/index.php?title=PHP/Functions/Definition&amp;diff=699&amp;oldid=prev"/>
				<updated>2010-05-26T07:05:00Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Accessing a Global Variable from Within a Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  $GLOBALS[&amp;quot;user&amp;quot;] = &amp;quot;myusername&amp;quot;;&lt;br /&gt;
  $GLOBALS[&amp;quot;pass&amp;quot;] = &amp;quot;mypassword&amp;quot;;&lt;br /&gt;
  &lt;br /&gt;
  function validatelogin ($username, $password){&lt;br /&gt;
    if (strcmp ($username, $GLOBALS[&amp;quot;user&amp;quot;]) == 0 &amp;amp;&amp;amp; strcmp ($password, $GLOBALS[&amp;quot;pass&amp;quot;]) == 0){&lt;br /&gt;
      return true;&lt;br /&gt;
    } else {&lt;br /&gt;
      return false;&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  if (validatelogin (&amp;quot;myusername&amp;quot;,&amp;quot;mypassword&amp;quot;)){&lt;br /&gt;
    echo &amp;quot;You are logged in correctly&amp;quot;;&lt;br /&gt;
  } else {&lt;br /&gt;
    echo &amp;quot;You have an incorrect username and/or password&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A Function Requiring Two Arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
    function headingWrap( $txt, $size ) {&lt;br /&gt;
        print &amp;quot;&amp;lt;h$size&amp;gt;$txt&amp;lt;/h$size&amp;gt;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    headingWrap(&amp;quot;A&amp;quot;, 1);&lt;br /&gt;
    headingWrap(&amp;quot;B&amp;quot;,2);&lt;br /&gt;
    headingWrap(&amp;quot;C&amp;quot;,3);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A function that calculates sales tax==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
$price = 4.9;&lt;br /&gt;
$tax = .04;&lt;br /&gt;
function calculate_cost($tax, $price) {&lt;br /&gt;
     $sales_tax = $tax;&lt;br /&gt;
     return $price + ($price * $sales_tax);&lt;br /&gt;
}&lt;br /&gt;
$total_cost = calculate_cost ($tax, $price);&lt;br /&gt;
$total_cost = round($total_cost, 2);&lt;br /&gt;
print &amp;quot;Total cost: &amp;quot;.$total_cost;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A Function to Build Query Strings==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Using http_build_query() to Build Query Strings&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$q = array (&lt;br /&gt;
    &amp;quot;name&amp;quot; =&amp;gt; &amp;quot;Tom&amp;quot;,&lt;br /&gt;
    &amp;quot;interest&amp;quot; =&amp;gt; &amp;quot;Movie&amp;quot;,&lt;br /&gt;
    &amp;quot;homepage&amp;quot; =&amp;gt; &amp;quot;http://www.example.ru&amp;quot;&lt;br /&gt;
    );&lt;br /&gt;
$query = http_build_query( $q );&lt;br /&gt;
print $query;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
&amp;lt;a href=&amp;quot;anotherpage.php?&amp;lt;?php print $query ?&amp;gt;&amp;quot;&amp;gt;Go!&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==A Simple User Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
function foo( ) {&lt;br /&gt;
            return  1;&lt;br /&gt;
    }&lt;br /&gt;
    print foo( );&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Build and then call a function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  function helloworld (){&lt;br /&gt;
    echo &amp;quot;Hello World!&amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  helloworld();&lt;br /&gt;
  &lt;br /&gt;
  function saysomething ($something){&lt;br /&gt;
    echo $something . &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  Saysomething (&amp;quot;Hello World!&amp;quot;); //This would output &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
  function addvalues ($firstvalue, $secondvalue){&lt;br /&gt;
    return $firstvalue + $secondvalue;&lt;br /&gt;
  }&lt;br /&gt;
  $newvalue = addvalues (1,3); &lt;br /&gt;
  echo $newvalue; &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Call the function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
function hi(  ){&lt;br /&gt;
    echo (&amp;quot;Hello from function-land!&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
hi(  );&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Create a User Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;html&amp;gt; &lt;br /&gt;
&amp;lt;head&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;Create a User Function&amp;lt;/title&amp;gt; &lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
function myFunction($company) { &lt;br /&gt;
    print(&amp;quot;&amp;lt;p&amp;gt;Welcome to $company&amp;lt;/p&amp;gt;&amp;quot;); &lt;br /&gt;
} &lt;br /&gt;
?&amp;gt; &lt;br /&gt;
&amp;lt;/head&amp;gt; &lt;br /&gt;
&amp;lt;body&amp;gt; &lt;br /&gt;
&amp;lt;h3&amp;gt;Start&amp;lt;/h3&amp;gt; &lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
$company = &amp;quot;A&amp;quot;; &lt;br /&gt;
myFunction($company); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Create function from string==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;?&lt;br /&gt;
$lambda =create_function(&amp;quot;$a,$b&amp;quot;,&amp;quot;return(strlen($a)-strlen($b));&amp;quot;);&lt;br /&gt;
$array = array(&amp;quot;really long string here,boy&amp;quot;, &amp;quot;this&amp;quot;, &amp;quot;middling length&amp;quot;,&lt;br /&gt;
               &amp;quot;larger&amp;quot;);&lt;br /&gt;
usort($array,$lambda);&lt;br /&gt;
print_r($array);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Creating and calling a function that accepts arguments==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
function saysomething ($something){ &lt;br /&gt;
    echo $something . &amp;quot;&amp;lt;br /&amp;gt;&amp;quot;; &lt;br /&gt;
} &lt;br /&gt;
Saysomething (&amp;quot;Hello World!&amp;quot;); &lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Declaring a Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;Declaring a Function&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
function bighello(){&lt;br /&gt;
     print &amp;quot;&amp;lt;h1&amp;gt;HELLO!&amp;lt;/h1&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
bighello();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
 &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Declaring a Simple Function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  function aFunction(){&lt;br /&gt;
      print &amp;quot;Music is a way of life!&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  aFunction();&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Define constant in a function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
define(&amp;quot;CONST1&amp;quot;, 1);&lt;br /&gt;
function MyTest() {&lt;br /&gt;
  define(&amp;quot;CONST2&amp;quot;, 2);&lt;br /&gt;
}&lt;br /&gt;
MyTest();&lt;br /&gt;
echo &amp;quot;CONST1 = &amp;quot; . CONST1 . &amp;quot; and CONST2 = &amp;quot; . CONST2 . &amp;quot;\n&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Defining functions before or after calling them==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
function page_header() {&lt;br /&gt;
    print &amp;quot;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Welcome to my site&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;quot;;&lt;br /&gt;
    print &amp;quot;&amp;lt;body bgcolor=&amp;quot;#ffffff&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
page_header();&lt;br /&gt;
print &amp;quot;Welcome, $user&amp;quot;;&lt;br /&gt;
page_footer();&lt;br /&gt;
function page_footer() {&lt;br /&gt;
    print &amp;quot;&amp;lt;hr&amp;gt;Thanks for visiting.&amp;quot;;&lt;br /&gt;
    print &amp;quot;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Function printing text on a Web Page==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;HTML&amp;gt;&lt;br /&gt;
  &amp;lt;HEAD&amp;gt;&lt;br /&gt;
  &amp;lt;TITLE&amp;gt; Printing text on a Web Page &amp;lt;/TITLE&amp;gt;&lt;br /&gt;
  &amp;lt;/HEAD&amp;gt;&lt;br /&gt;
  &amp;lt;BODY&amp;gt;&lt;br /&gt;
  &amp;lt;?php&lt;br /&gt;
  function textonweb ($content, $fontsize) {&lt;br /&gt;
     echo &amp;quot;&amp;lt;FONT SIZE=$fontsize&amp;gt;$content&amp;lt;/FONT&amp;gt;&amp;quot;;&lt;br /&gt;
  }&lt;br /&gt;
  textonweb (&amp;quot;A &amp;lt;BR&amp;gt;&amp;quot;, 7);&lt;br /&gt;
  textonweb (&amp;quot;AA. &amp;lt;BR&amp;gt;&amp;quot;, 3);&lt;br /&gt;
  textonweb (&amp;quot;AAA. &amp;lt;BR&amp;gt;&amp;quot;, 3);&lt;br /&gt;
  textonweb (&amp;quot;AAAA! &amp;lt;BR&amp;gt;&amp;quot;, 3);&lt;br /&gt;
  ?&amp;gt;&lt;br /&gt;
  &amp;lt;/BODY&amp;gt;&lt;br /&gt;
&amp;lt;/HTML&amp;gt;&lt;br /&gt;
           &lt;br /&gt;
       &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==global key word in a function==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$a = 7;&lt;br /&gt;
function test() {&lt;br /&gt;
  global $a;&lt;br /&gt;
  $a = 20;&lt;br /&gt;
}&lt;br /&gt;
test();&lt;br /&gt;
echo &amp;quot;\$a = $a\n&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==nesting functions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
function myFunction($price,$tax) {&lt;br /&gt;
   function convert_pound($dollars, $conversion=1.6) {&lt;br /&gt;
      return $dollars * $conversion;&lt;br /&gt;
   }&lt;br /&gt;
   $total = $price + ($price * $tax);  &lt;br /&gt;
   echo &amp;quot;Total cost in dollars: $total. Cost in British pounds: &amp;quot; . convert_pound($total);&lt;br /&gt;
}&lt;br /&gt;
myFunction(15.00,.075);&lt;br /&gt;
echo convert_pound(15);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Using nested functions==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;?&lt;br /&gt;
function display_footer($site_name) {&lt;br /&gt;
         function display_copyright($site_name) {&lt;br /&gt;
              print &amp;quot;&amp;amp;copy &amp;quot;. date(&amp;quot;Y&amp;quot;). &amp;quot; $site_name.&amp;quot;;&lt;br /&gt;
         }&lt;br /&gt;
         print &amp;quot;contact us&amp;lt;br&amp;gt;&amp;quot;;&lt;br /&gt;
         display_copyright($site_name);&lt;br /&gt;
}&lt;br /&gt;
$site_name = &amp;quot;PHP&amp;quot;;&lt;br /&gt;
display_footer($site_name);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Variables Defined Outside Functions Are Inaccessible from Within a Function by Default==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;html4strict&amp;quot;&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;title&amp;gt;No Default Access to Globals in Functions&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;div&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
    $life = 42;&lt;br /&gt;
    function meaningOfLife() {&lt;br /&gt;
      print &amp;quot;The meaning of life is $life&amp;lt;br /&amp;gt;&amp;quot;;&lt;br /&gt;
    }&lt;br /&gt;
    meaningOfLife();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  &amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>