Jump to content

majortom84

New Members
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

0 Neutral

About majortom84

  • Rank
    Newbie
  1. majortom84

    count each time the function runs

    function Counter() { static $count; $count++; return $count; } echo Counter(); echo Counter(); echo Counter(); GOT IT !!! 123
  2. majortom84

    count each time the function runs

    //$count = 0; //static $counter = 0; function Counter() { global $counter; $count = $count + 1; return $count; } echo Counter(); echo Counter(); echo Counter(); got it to ... 111 with this so i hope im getting closer. I will keep at it
  3. majortom84

    count each time the function runs

    no its just keeping $count at 0
  4. Write a function Counter() that keeps track of the number of times it is called. This function should not take any parameters and return the number of times that it has been called. Example: echo Counter();//1 echo Counter(); //2 I think I would go like this... $count = 0; function Counter() { $count = $count + 1; } Is this too simple? Am I doing it wrong
  5. majortom84

    access array element

    ah I see so.... $arr[9] would be this element
  6. majortom84

    access array element

    How would you access the number 10 in the $arr array? <?php $val = ‘1.2.3.4.5.6.7.8.9.10.11.12’; $arr[] = array(‘a’=>explode(‘.’,$val)); ?>
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.