James Bachini

Mixing php with javascrip – Heredoc

My main issue with javascript is the fact it is full of ‘ and ” which can be a real pain when coding. I’ve started using a method called heredoc to set a start and end point, example below.

// Heredoc string //
$sstring = <<<TEST
Hello World
TEST;

The word TEST could be anything and it wont finish inputing the string until it comes across it again. This is a really simple way to add a portion of javascript to php code.


Get The Blockchain Sector Newsletter, binge the YouTube channel and connect with me on Twitter

The Blockchain Sector newsletter goes out a few times a month when there is breaking news or interesting developments to discuss. All the content I produce is free, if you’d like to help please share this content on social media.

Thank you.

James Bachini

Disclaimer: Not a financial advisor, not financial advice. The content I create is to document my journey and for educational and entertainment purposes only. It is not under any circumstances investment advice. I am not an investment or trading professional and am learning myself while still making plenty of mistakes along the way. Any code published is experimental and not production ready to be used for financial transactions. Do your own research and do not play with funds you do not want to lose.


Posted

in

by