General Zone > The Lounge

Helping Roumlus to stop his prof calling him a noob tomorrow :D

<< < (3/5) > >>

hellfire:
Glad you got the help needed :) I just finished another round of work (after evening gaming) and took a look here and this is the power of teamwork hehe.  I have to make up contracts and model stuff up for strategy. So, wine + number crunching all weekend /week. So, sorry I could not help more before but wonderful to see the rest pitch in :)

Just 1 note: Start writing comments in your code from early on. A good coder always comments so that everyone can work rapidly. Anyway you will soon git your life away lol

-Adler-:
https://www.php.net/manual/en/language.variables.scope.php
i extended the examples here...

--- Code: ---<p>scope. For example:</p>
<?php
$a = 1; /* global scope */ 

function test()

    echo $a; /* reference to local scope variable */ 


test();
?>

<p>This script will not produce any output because the echo statement refers to a local version of the $a variable, and it has not been assigned a value within this scope. You may notice that this is a little bit different from the C language in that global variables in C are automatically available to functions unless specifically overridden by a local definition. This can cause some problems in that people may inadvertently change a global variable. In PHP global variables must be declared global inside a function if they are going to be used in that function.
</p>

<p>example 2</p>
<?php
$a = 1; /* global scope */ 

function testb($parametera)

    echo $parametera; /* output 1 */ 


testb($a);
?>

<p>example 3</p>
<?php
$a = 1; /* global scope */ 

function testc($a = 2)

    echo $a; /* output 2 */ 


testc();
?>


<p>example 4</p>
<?php
$a = 1; /* global scope */ 

function testd($a)

    echo $a; /* output 1 */
    echo '<p></p> ';
    $a = $a + 5;
    echo $a;/* output 6 */


testd($a);
echo '<p></p> ';

echo $a; /* output 1 */
?>


<p>example 5 return</p>
<?php
$a = 1; /* global scope */ 

function teste($a)

    
    $a = $a + 5;
    return $a;/* return 6 */

echo $a;/* output 1 */
$a = teste($a); /* returned value 6*/
echo '<p></p> ';
echo $a; /* output 6 */
?>

--- End code ---

Romulus:

--- Quote from: -Adler- on April 22, 2022, 00:49 ---i extended the examples here...

--- End quote ---
Thank you very much!!!

Romulus:

--- Quote from: hellfire on April 21, 2022, 21:58 ---Glad you got the help needed :)

--- End quote ---
I was really glad I got so many versions! Surprised me! I didn’t expect anyone to help me ... thank you so much for the many valuable answers to everyone!

-Adler-:
I'm writing my own little CMS (Content Management System) for myself and my local sports club and IT junkies site... 5min analysis of the question and translation into English German. Comments are helpful.
   I wrote the code in 5 minutes. But keep it simple so you understand. (Input Output -> Result). I saw your redesigned form. Always validate user input is the first rule. The second rule is to check if you are also entering a number or text... or a time... for a later database query...
They're also a great way to learn, but programming isn't everything. Different end devices and systems must also be taken into account.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version