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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.