0

Im trying to get the second echo to echo out the message but the first echo dont let me. I know the second echo works and the first too but when I but them together it wont work. Also im new to this so help is appreciated.

echo
'<h1 class="text-center text-info" >J!inder</h1> <br> 
<div class="container d-flex justify-content-around" >
    
    'echo $create->profilerand();'
    </div>';
NiklasHed
  • 13
  • 3

2 Answers2

3

use concat

echo
'<h1 class="text-center text-info" >J!inder</h1> <br> 
<div class="container d-flex justify-content-around" >
    
    ' . $create->profilerand(). '
    </div>';
user
  • 82
  • 1
  • 5
1

PHP automatically uses the original echo, so you don't need it when using a variable.

echo
'<h1 class="text-center text-info" >J!inder</h1> <br> 
<div class="container d-flex justify-content-around" >
    
    '.$create->profilerand().'
    </div>';

The code removes the echo and ;, then replaces it with . which is just the joining character. echo is just a print function, and prints it onto the page. You can't print a printer. This also means you can use variables in variables (e.g. $whatever = "Lorem ".$create->profilerand()." ipsum";).

ethry
  • 731
  • 6
  • 17