Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用isset和运算符作为一个三元语句_Php_Laravel_Laravel 4 - Fatal编程技术网

Php 如何使用isset和运算符作为一个三元语句

Php 如何使用isset和运算符作为一个三元语句,php,laravel,laravel-4,Php,Laravel,Laravel 4,在三元语句中是否有一种执行三元语句的方法。比如说 @if (isset($checking)) <input type="radio" id="box" name="form" value="10" {{$checking->myvalue == 10.0 ? 'checked' : ''}}/> <label class="sister" for="boxwindow" title="myvalue_10" </label> @else <input

在三元语句中是否有一种执行三元语句的方法。比如说

@if (isset($checking))
<input type="radio" id="box" name="form" value="10"
{{$checking->myvalue == 10.0 ? 'checked' : ''}}/>
<label class="sister" for="boxwindow" title="myvalue_10" </label>
@else
<input type="radio" id="box" name="form" value="10"/>
<label class="sister" for="boxwindow" title="myvalue_10" </label>
@endif               
@if(设置($checking))
myvalue==10.0?“选中“:”}}/>
试试这个

$foo = 1;
$bar = ($foo == 1) ? "1" : (($foo == 2)  ? "2" : "other");
echo $bar;

您可以尝试以下方法:

<input type="radio" id="box" name="form" value="10"
isset($checking->myvalue) == 10.0 ? 'checked' : ''}}/>
<label class="sister for="boxwindow" title="myvalue_10" </label>             
{{ isset($checking->myvalue) && $checking->myvalue == 10 ? 'checked' : '' }}

<?php echo isset($formData['employer_name'])?$formData['employer_name']:'_________________'; ?>
(isset($checking->myvalue) && $checking->myvalue == 10)?'checked' : '';