0

Please need to clear up the next issue : for a code like this:

 <?php

   class Render {

      public static function displayDimensions($size){

         return $size["length"];
      }
    } 
  $size_arr = array ("length"=>8, "width"=>4);

  echo (Render::displayDimensions($size_arr));

 ?>

I cannot understand why php throwing in this notice:

PHP Notice: Undefined index: length in index.php on line 7

Thank you!)

u_mulder
  • 54,101
  • 5
  • 48
  • 64
Dmitry
  • 1
  • Works fine. https://3v4l.org/eBmNn – Charlotte Dunois Dec 17 '16 at 13:02
  • Possible duplicate of [PHP: "Notice: Undefined variable" and "Notice: Undefined index"](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) – u_mulder Dec 17 '16 at 13:07
  • Code works fine! Are you sure it's not a writing error? Maybe in the array var that you are trying to use, you write `lenght` instead of `length`; or you are missing to add some values in the rest of `index.php`. Can you post more code? – Yeti82 Dec 17 '16 at 13:17
  • thanks u_mulder! you're right it was just a writing error!) – Dmitry Dec 17 '16 at 14:40

0 Answers0