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

Recommended Answers

All 4 Replies

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';

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

commented: Not only do I agree, here's a +1, :) +13
Member Avatar for diafol

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!

commented: First time you agreed with me hahaha! :P +5

Thank you MG and ardav :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.