Answer
You can use yes.
But why?
Both Google and any other search engine or browser will understand the data the same way you would if you set the values directly in HTML.
This is basic PHP concept.
PHP is a server-side language, meaning it runs on the server side. So, before any HTML information is sent to anyone, it will be processed by the PHP module, which will generate a complete HTML and only then send to the visitor / requester.
Don’t get it yet?
Let’s illustrate.
- The visitor accesses your domain and requests the index.php file (or any other);
Your original index.php file looks like this
<?php
$descricao = 'informatica, hospedagem, criação de sites, cloud';
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Meu site - Menino sagaz</title>
<meta name="description" <?php echo "content='" . $descricao . "'"; ?>>
</head>
<body>
<h1>Olá, mundo!</h1>
</body>
</html>
- Your server will receive the request and is a file. php, will trigger the PHP module to interpret any and all PHP code in the file.
Then the PHP module does its job and turns your index.php file into this
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Meu site - Menino sagaz</title>
<meta name="description" content='informatica, hospedagem, criação de sites, cloud'>
</head>
<body>
<h1>Olá, mundo!</h1>
</body>
</html>
- With the file ready, it sends the index.php to the visitor and everyone is happy.
PS: visitor can be anyone, be the visitor (ôh), Google, Bing and even Yahoo.
In short
It doesn’t matter if you made your site 100% using echo to generate HTML’s and content. The visitor will NEVER know how it was done, because he will always receive the ready file, already processed by the PHP module.
Yes, you can. You’ve tried? ;)
– brasofilo
No, because I was afraid something went wrong. My idea is the same as <title><? php echo $title; ? ></title> On each page I will define the variables $Description and $Keywords, and la in the header will fetch this variable. So each page will have its own, right? I don’t know if I’m right, but it takes a few days for google to print these new values in its results, right?
– Cobra
The nice thing is to install Xamp or similar on your machine, so you can run php locally to test the will
– brasofilo
I already use Wamp! I believe that this time I spoke nonsense... just I test the variables in the metatag and display the source code of each page to know if it is changing, right?! What a wobble! rs
– Cobra
yes, exactly
– brasofilo
Being able to do this can, but you have to know if Google and other browsers will actually take into account the content you have in these variables.
– Diego Filipe Pedro Santos