Does PHP support ASI? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Does PHP support ASI?

auto semicolon insertion

25th Oct 2017, 1:59 AM
Patrick Fulghum
Patrick Fulghum - avatar
5 Answers
+ 18
@PF it's needed when you try it with a single/last echo statements it works good. else throws error <?php echo "Hello friends"; echo 'only for single statements' ?>
25th Oct 2017, 2:45 AM
Lord Krishna
Lord Krishna - avatar
+ 4
I think so. But which software does that?
25th Oct 2017, 2:32 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
I come from JavaScript where if you forget a semicolon it can be inserted automatically.
25th Oct 2017, 2:34 AM
Patrick Fulghum
Patrick Fulghum - avatar
+ 1
the semicolon seems necessary if there are additional echo commands. However I get no errors when I leave it off the final echo.
25th Oct 2017, 2:56 AM
Patrick Fulghum
Patrick Fulghum - avatar
25th Oct 2017, 2:59 AM
Patrick Fulghum
Patrick Fulghum - avatar