Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

636
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!