0

Hi everyone..

I was going thru php interview questions and came across these doubts.

What does a special set of tags <?= and ?> do in PHP? - The output is displayed directly to the browser.
I saw this in a blog written in 2005 is this still valid or is it deprecated?? cos i cud not get this to run. i tried <?= hello world ?> and <?php <?= hello world ?> ?> both of these dont work..

how can i get "$a,000,000 dollars" as output. i cud get "$4" and "$400000"

thanks for ur time and effort
puvi

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by puvi
0

About the tags, I don't understand why you have complicate things about that. Its just a format on how are you going to insert PHP code. It's programming. There are syntax and rules which you need to follow.

about the dollar sign

This should work

echo '$500,000';
1

Btw about the <?= Output ?> thing, They could have been depreciated or infact just a setting on the server. Also, <? ?> doesn't usually works until you set it on php.ini I think

Votes + Comments
Not only do I agree, here's a +1, :)
1

Yeah, agree with MG - avoid <? .. ?> and <?= ... ?> (short tags). Use full: <?php ...?> and <?php echo ... ?>

While they will run on some servers, you may move your code one day and all of a sudden EVERYTHING stops working. Hell of a pain to change EVERY open tag!

Votes + Comments
First time you agreed with me hahaha! :P
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.