Jump to content

Greater than '>' problem in php code in html body


dormouse1976

Recommended Posts

Hi,

 

I know its been a few years, and my php is rusty at best, but the following has me stumped.

 

if i have a greater than symbol within a section of php code, embedded with the <body> section of a .html file, then when viewing the page, the parser jumps out of the php script, and displays the rest of the script as though normal html, until a less than symbol is encountered, and it then proceeds to behave as though php again.

 

example

 

<head>

<title>My Brain Hurts!!</title>

</head>

 

<body>

<?php

$rbg = 0xFFFFFF;

$r = ($rgb >> 16) & 0xFF;

?>

</body>

 

will display, when run from a browser

 

 

> 16) & 0xFF; ?>

 

 

Have i forgotten more than i think, and missing something rather obvious, or is something screwie going on?

 

TIA,

 

dormouse

it's not jumping in and out.

The server picks up the < symbol as it's a basic html symbol for writing any code, so it assumes there is valid html after it and hides it to the browser. Just like

<a>

It doesn't display the 'a', but after the closing > it shows anything past that point.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.