1
I use Laravel 5.3.
I have a variable that returns this value in a var_dump():
array(3) {
[1]=>
string(5) "10:00"
[2]=>
string(5) "10:20"
[3]=>
string(5) "11:40"
}
But if I give:
@foreach($variavel as $valor)
<label for="{{$valor}}"> {{$valor}} </label>
<input type="checkbox" id="{{$valor}}" name="horario[0][]" />
@endforeach
He printed it out:
<label for="10:00">10:00</label>
<input type="checkbox" id="10:00" name="horario[0][]" />
<label for="10:20">10:20</label>
<input type="checkbox" id="10:20" name="horario[0][]" />
<label for="11:40">11:40</label>
<input type="checkbox" id="11:40" name="horario[0][]" />
And if I do:
@foreach($variavel as $valor)
<label for="{{print $valor}}"> {{print $valor}} </label>
<input type="checkbox" id="{{print $valor}}" name="horario[0][]" />
@endforeach
I printed it out:
10:00 1 10:20 1 11:40 1
I do not understand where this number 1 can come from after each printed value, because if I do this print within the tags of PHP he does not appear. What could cause this? Could I be clear? ps.: between value and number 1 appears checbox?
Enter all foreach code
– novic
Thanks for the help @foreach($horarios_free as $horario_free) {print $horario_free}} @endforeach If I use {{$horario_free}} it prints the HTML code, this: <input value="10:00" type="checkbox" name="time[0]]"/>, instead: 10:00
– Cleber Martins