Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

640
Vistas
Can't make text bold in PHP

I'm new to PHP and trying to write a PHP script to output some text in boldface. I've tried every combination of echo / print, < b> / < strong> but no matter what, the output is always like this: <strong>Text</strong>

<?php
    print "<strong>Text</strong>";
?>

Why is this happening? I'm using PhpStorm, could there be a setting I have to fix?

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Make sure your are opening your php file in your localhost. For example your filename is index.php you should run it at localhost/index.php. PHP scripts do not run when u just open it in your browser like HTMLs.

Can you add the current URL you are working with?

over 4 years ago · Santiago Trujillo Denunciar

0

check that which content-type it is. Make sure the text/html is correct. And also you should put some screenshots of your web server configuration.

over 4 years ago · Santiago Trujillo Denunciar

0

Maybe you dont have the correct settings in the project for the HTML to be loaded properly, e.g. not the correct meta settings Try this:

<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <?php
      print "Text\n";
      print "<b>Text</b>";
    ?>
  </body>
</html>

If it doesn't work, try this meta tag instead:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

UPDATE:

The reason this could happen, is because you have a PHP file, but you are using HTML within your PHP file - which is okay, but you have to render/return the php within html tags. For this to be rendered, you have to render the HTML within an HTML tag, or the HTML tags wont be rendered. Right now you are rendering HTML without having referenced the HTML anywhere.

What you could do is in the php tag in the html file, within body, specify a function:

<b><?php outputtext(); ?></b>

In your PHP file you specify the function as

function outputtext() {
  return "hello world";
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda