Jump to content

foreach loop just getting the keys


MadnessRed

Recommended Posts

I have a foreach loop as shown below.

 

foreach($d as $i => $a){
$d[$i] *= $percent;
}

 

whilst this code works fine when I use analyse code I get the following

The variable assigned to $a is never used

 

This is the 1 error in the script so I was wondering if there was a way that would avoid having to declare $a,

 

eg

 

foreach($d as $i => NULL){

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/150942-foreach-loop-just-getting-the-keys/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

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.