php - How do I get .png images with my foreach loop right? -
first of all, i'm sorry english, isn't best.
now have foreach loops:
@foreach(array_combine($land_keys, $land_values) $key => $value) @foreach($all_lands_flag $flag) @if(strtolower($key) == $flag) <tr> <td><img src="/flags/{{$flag}}.png"/></td> <td width="86%">{{$key}}</td> <td>{{$value}}</td> </tr> @endif @endforeach @endforeach
the @ before php commands @if, @foreach because i'm using laravel framework.
like can see have arrays in foreach , work's perfect, there aren't problems. it's more part:
@foreach($all_lands_flag $flag) @if(strtolower($key) == $flag) <tr> <td><img src="/flags/{{$flag}}.png"/></td> <td width="86%">{{$key}}</td> <td>{{$value}}</td> </tr> @endif @endforeach
in $flag names 'de', 'usa', 'it' ... in $key same, compare them , if php finds flags in $key , in $flag, should give me them:
<img src="/flags/{{$flag}}.png"/>
well, don't works. if remove {{$flag}}.png , replace usa.png, gives me usa flag array elements. thing is, need did in code, every land, own flag.
i hope of can me!
output should this:
flag: land: quantity: 'germany flag' de 155 'italian flag' 100 'usa flag' usa 55
outputs:
$all_lands_flag = array('cn', 'fr', 'us', 'at', 'il', 'ua', 'de', 'us', 'eu', 'ru', 'br', 'gb', 'nl', 'lu', 'it', 'other');
$land_keys output:
array ( [0] => "us" [1] => "de" [2] => "br" [3] => "fr" [4] => "other" )
$land_values
array ( [0] => 186 [1] => 44 [2] => 15 [3] => 3 [4] => 7 )
Comments
Post a Comment