i have a problem with foreach in php
i tried to execute this code but at the end $part does not include bought
what's the problem?
foreach ($parts as $part){
foreach ($boughtParts as $boughtPart){
if($part['part_id'] == $boughtPart['part_id'])
$part['bought'] = 1;
}
}
Try this : foreach ($parts as &$part)
This will be passed by reference, but until now you were doing a copy.