Your question is incomplete - we can't see the actual code example so it's hard to tell what happens inside your function. I strongly recommend reading this excellent article How To Ask Questions The Smart Way
I recommend that you construct a minimalist example that shows the error like so:
<?php
function test($data){
print_r($data);
foreach ($data as $value) {
list($length, $hight) = $value;
echo("DEBUG: $length, $hight\n");
}
}
$data=array(array ("hoejdemeter" => 1152, "laengde" => 24120 ) );
test($data);
?>
Output then is:
Array
(
[0] => Array
(
[hoejdemeter] => 1152
[laengde] => 24120
)
)
PHP Notice: Undefined offset: 0 in /tmp/foo.php on line 7
PHP Notice: Undefined offset: 1 in /tmp/foo.php on line 7
DEBUG: ,
I guess what you wanted to do instead was:
<?php
function test($data){
print_r($data);
foreach ($data as $value) {
print_r($value);
list($length, $hight) = array_values($value);
echo("DEBUG: $length, $hight\n");
}
}
$data=array(array ("hoejdemeter" => 1152, "laengde" => 24120 ) );
test($data);
?>
Output:
Array
(
[0] => Array
(
[hoejdemeter] => 1152
[laengde] => 24120
)
)
Array
(
[hoejdemeter] => 1152
[laengde] => 24120
)
DEBUG: 1152, 24120