Use a PHP variable in your Javascript code

What if you’d like to use a PHP variable in your javascript code?

You can use this code in your javascript:



In order to use this PHP function, you need to have at PHP version 5.2.

What does this function do? This returns the JSON representation of a value. Take note that this function works only with data encoded in UTF-8.

Learn more about the function here.

Leave a Reply

Categories

Interested for a quote?

Business Days: Monday to Friday

Time Zone: GMT +8

Response time: Within 24 hours except for inquiries sent on Fridays.

Contact Us

View our Sample Works