0

How can I assign the value 1990 to born_year in $u0? I get an error massage saying Invalid text string.

 <?php if($u0->i_sex=='98') { ?>    
    $u0->born_year =1990;
  <?php } ?>    
Mr_G
  • 127
  • 1
  • 12
  • Does this answer your question? [Reference - What does this error mean in PHP?](https://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – Syscall Mar 01 '21 at 09:53

2 Answers2

0

All PHP inside the " <?php ?>" tag

<?php 
 if($u0->i_sex=='98') { 
    $u0->born_year =1990;
 } 
?> 
Ivan Buttinoni
  • 4,110
  • 1
  • 24
  • 44
0

You are using PHP outside of the PHP tags.

  • <?php is used at the start of your PHP code.
  • ?> is used at the end of your PHP code.

Try:

<?php 
  if($u0->i_sex=='98') {  
    $u0->born_year =1990;
  } 
?> 
Miroslav Glamuzina
  • 4,472
  • 2
  • 19
  • 33