-1

I write this bellow code

<div class="description"><?php echo substr($data['description'],strpos($data['description'],$info['title']),100); ?></div>

when I change method to this bellow code I get an error!!

 <?php echo'<div class="description">'.substr('.$data['description'].',strpos('.$data['description'].','.$info['title']).',100).'</div>'; ?>

error: Parse error: syntax error, unexpected T_STRING...

For.oi
  • 29
  • 11

1 Answers1

0

You need to write your PHP code inside <?php and ?> tags.

You cant just write your php code as a string. PHP interpreter needs to know what code should be interpreted.

EDIT:

You cant put variables names in quotes. Try this:

<?php echo '<div class="description">' . substr($data['description'], strpos($data['description'], $info['title']), 100) . '</div>'; ?>
Dawid Urbanski
  • 571
  • 6
  • 13