Why do we have the dollar sign before every php variable?

Browser interpreting PHP code as HTML after -> sign. How can I stop it?

  • I am working on a website using XAMPP. PHP is configured correctly. There is no syntax error in the code. File extension ends in .php. I point to it by http://localhost/file.php. Here is the code: <?php include_once('simpleDom.php'); $target_url = "http://www.example.com"; $html = new simpleDom(); $html->load_file($target_url); foreach($html->find('img') as $img) { echo $img->src."<br />"; echo $img."<br/>"; } ?>

  • Answer:

    please check that there are no short tags in the code such as <? ?> because short tags are off by default in xampp, you can either turn them on or remove short tags and use <?php ?> i nstead

Faizan Ali at Quora Visit the source

Was this solution helpful to you?

Other answers

Did you make sure it's not ALL getting sent to the browser?  The results you describe are consistent with how a browser would display that content.

Peter Gee

Make sure apache loaded php module (uncomment php5_module in httpd.conf)

Roman Piekarski

I got the Answer: It was all text editors fault. Thanks anyways all of you.

Furqan Shafi

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.