undefined variable error javascript with php

undefined variable error javascript with php

you want to do something simple like passing variable like this

<?php 
 $variable_name = "some value";
var some_var = <?=$variable_name" ?>;

but it didn’t work
Here is the solved version…
Very simple than you thought

<pre>
 $variable_name = "some value";
var some_var = "<?=$variable_name" ?>";
</pre>

yup, just quote it from left and right so that it wont be considered as string not JS variable. If the value in variable is number, there would not be any problem

See how you would solve these known algorithm problems

Implement Queue Using two Stacks – JavaScript algorithm

binary tree problems with solution

testing k complementary pairs algorithm with junit

Java solution for checking anagram strings – tell if phrases are anagrams

Check if there are three numbers a, b, c giving a total T from array A

Check if two strings are anagrams or not

Find the pairs that makes K Complementary in the given array java solution

Array reversal in Recurrsion

find longest word in the sentence

Get maximum occurring character

2 Comments
  1. plus size maxi dresses

    Yoou reall mzke it seem sso easy wth your presentation
    but I find this topic to bee reaply something which I think
    I would never understand. It seems too complicated annd extremely road for
    me. I am looking forward for your next post, I will try too gget the hang of it!

    1. gullele

      Am sorry about it being easy looking approach.. I will try to have another post with more elaboration

Leave a Reply to plus size maxi dresses Cancel reply

Your email address will not be published. Required fields are marked *

*
*