|
What is more efficient and/or what is better practice. To echo the html or the have many open and close php tags?
Obviously for big areas of html it is sensible to open and close the php tags. What about when dealing with something like generating XML...
Started by Mark on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
But an echo of a big string is hard to read and more <?php echo $this->that; ?> tell a story_double_quote'),....
Example:
echo <<.
Check it out please.
PHP solves this problem by what is known as heredocs .
|
|
So I have a script that I debug with a bunch of echo statements. This is run every 3 minutes on my server by cron, and I sometimes leave the echo statements in there. They're not going to a browser, they're just going... anywhere?
This is a vague question...
Started by Alex Mcp on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You can write the output of your script to a file via:
php myscript.php > /var the output elsewhere on the....
Is that if you leave some echo statements in a PHP script and set it as a cron job, then you will start of the crontask).
|
|
Hi i work a lot in mixed html and php and most time i just want solid html with a fet php variables in it so my code look like this
<tr><td> <input type="hidden" name="type" value="<?php echo $var; ?>" ></td></tr>
wich...
Started by matthy on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Personally I don't mind mixing HTML and PHP like so
<a href="<?php echo php configuration.....
In their internal implementation:
<?= $var1, $var2 ?> <?php echo $var1, $var2 ?> information on why.
|
Ask your Facebook Friends
|
The PHP short tag <?= $var ?> has been deprecated for a while. Almost all PHP frameworks use the long form <?php echo $var ?> (e.g., symphony , Yii , Kohana ) Smarty is a famous PHP template engine which supports a shorter form {$var} Template...
Started by Wernight on
, 9 posts
by 9 people.
Answer Snippets (Read the full thread at stackoverflow):
Foreach ($k as $v) { ?> <option value="<?php echo htmlentities($v['value']); ?>"><?php echo htmlentities($v['label']); ?></option> <?php } ?> </select>
NowThere are some reasons....
|
|
I recently looked at my source code and it was a real mess.
my php source:
echo '<h1>Rar<h1>'; echo '<span>Rar</span>'; echo '<p>Rar</p>';
and when I view the browser source for the page rendered:
<h1>Rar</...
Started by Ygam on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
This would append the OS specific newline values with echo like this:
echo 'one', $foo, PHP_EOL, 'two', $bar, PHP_EOL;
so there is no need; &....
Method and replace all echo statements with echo PHP_EOL, .
|
|
How do I change the color of an echo message and center the message in the PHP I've written. The line I have is:
echo 'Request has been sent. Please wait for my reply!';
Started by The Woo on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
echo '<div style....
Please wait for my/CSS Tutorial.
How about writing out some HTML tags and some CSS if you're outputting this to the console?
echo like:
echo '<p style="color: red; text-align: center"> Request has been sent.
|
|
My current solution will suck sometimes
EDIT
For those who don't understand,see this example:
<a title="<?php echo 'test';?>" >...
Started by Mask on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Try this:
<a title="<?php echo htmlentities($title); ?>">
<a title="<?php echo 'test'; ?>">
Is that what you're inserting PHP variable....
Template will write out a HTML using the above variables .
|
|
Do I really need this many echo's or can I make it shorter?
<?php if (!empty($url)) { echo '<p>Job: <span>' . $job .'</span></p>'; echo '<p>Skills: <span class="caps">' . $skills . '</span></p>'; echo...
Started by phpnut on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
Or even:
<?php if(!empty($url)) { echo "<p>Job: <span>{$job}</span>: {$pay}</p>"; } ?....
Why not revert it?
<?php if(!empty($url)) { ?> <p>Job;"; } ?>
...
More echo for the else stmt.
|
|
I'm trying to submit a page onto itself by using php echo $_SERVER['PHP_SELF']; but keep receiving the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near...
Started by jeansymolanza on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
The fact, not a particular....
Are you sure that the problem is when u are using "php echo $_SERVER['PHP_SELF']" ? The error thrown is an SQL Syntax error, and nothing to do with calling php echo $_SERVER['PHP_SELF'].
|
|
Is there any speed difference between these two versions?
<?php echo $var; ?> <?=$var?>
Which do you recommend, and why?
Started by grilix on
, 10 posts
by 10 people.
Answer Snippets (Read the full thread at stackoverflow):
If you like typing a lot use <?php echo $var; ?> , otherwise just this and rewrite the code to the '<?php echo' format
I think the second one requires the short_open_tag.)
<?php ....
No, they are identical.
|