if didalam echo

http://stackoverflow.com/questions/3507042/if-block-inside-echo-statement
http://hastomo.net/php/struktur-dalam-php/
http://www.duniailkom.com/tutorial-form-php-cara-membuat-validasi-form-php-fungsi-isset-dan-empty/



You can always use the ( <condition> ? <value if true> : <value if false> ) syntax (it's called the ternary operator - thanks to Mark for remining me :) ).
If <condition> is true, the statement would be evaluated as <value if true>. If not, it would be evaluated as <value if false>
For instance:
$fourteen = 14;
$twelve = 12;
echo "Fourteen is ".($fourteen > $twelve ? "more than" : "not more than")." twelve";



This is the same as:
$fourteen = 14;
$twelve = 12;
if($fourteen > 12) {
  echo "Fourteen is more than twelve";
}else{
  echo "Fourteen is not more than twelve";
}


echo"
   <tr>
    <td>$no</td>    
    <td>$p[nama_prodi]</td>
    <td>$d[nidn]</td>
    <td>$d[nama_doskar]</td>
    <td>$d[pendidikan]</td>
    <td>$krj[biaya_study]</td>
    <td>$krj[tmpt_bljr]</td>
    <td>$krj[thn_msk]</td>
    <td>".($krj['thn_lls'] != null ? "LULUS" : "Tidak LULUS")."</td>
    <td>$krj[thn_lls]</td>
    <td>$krj[no_ijasah]</td>
    
   </tr>";

Subscribe to receive free email updates:

0 Response to "if didalam echo"

Post a Comment