array uitlezen met key and value

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Senior, Medior and Junior SAP HANA Developer

Vacature details Vakgebied: Software/IT Opleiding: Medior Werklocatie: Veldhoven Vacature ID: 12696 Introductie Our client is the world's leading provider of lithography systems for the semiconductor industry, manufacturing complex machines that are critical to the production of integrated circuits or chips. Our purpose is “unlocking the potential of people and society by pushing technology to new limits”. We do this guided by the principles “Challenge”, “Collaborate” and “Care”. Wat verwachten we van jou? SAP Certified Application Associate - SAP HANA Cloud Modeling (training and/or certification) Bachelor degree or higher Excellent understanding of SAP HANA (2.0 / Cloud), Data Modelling and writing

Bekijk vacature »

Loek Lemmens

Loek Lemmens

12/05/2020 22:12:35
Quote Anchor link
Ik probeer mijn array uit te lezen met één foreach

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$specialprice
= array(
    '2' => '1,75',
    '3' => '1,62',
    '4' => '1,61',
    '8' => '1,59',
        
    );



foreach($specialprice as $price => $value){
    echo $price -> $value;
}

?>


Nu krijg ik deze error
NOTICE Trying to get property '1,75' of non-object on line number 12
NOTICE Trying to get property '1,62' of non-object on line number 12
NOTICE Trying to get property '1,61' of non-object on line number 12
NOTICE Trying to get property '1,59' of non-object on line number 12
 
PHP hulp

PHP hulp

20/04/2024 01:28:19
 
Rob Doemaarwat

Rob Doemaarwat

12/05/2020 23:01:12
Quote Anchor link
Bij je echo leest PHP nu "de property $value van het object $price". Ik neem aan dat je bedoelde:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
echo "$price -> $value\n";
(met quotes)
Gewijzigd op 12/05/2020 23:01:34 door Rob Doemaarwat
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.