Jump to content

[SOLVED] Count within Array


shamuraq

Recommended Posts

I believe this will do what you're looking for:

 

$output_counts = array();

for($x1 = 0; $x1 < $lebar; $x1++){
$x1 = $x1 + 30;
$a = array( '#FFFFFF', '#666666');
$a1 = $a[array_rand($a)];

$output_counts[$a1]++;	
}

print_r($output_counts);

I believe this will do what you're looking for:

 

$output_counts = array();

for($x1 = 0; $x1 < $lebar; $x1++){
$x1 = $x1 + 30;
$a = array( '#FFFFFF', '#666666');
$a1 = $a[array_rand($a)];

$output_counts[$a1]++;	
}

print_r($output_counts);

 

That's exactly what i am looking for but how do i store these results into different variable?

eg; i want to store

 

$color1 = count '#FFFFFF';

$color2 = count '#666666';

 

Thanx again patrick

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.