Timeline for Calling a javascript function on a php variable
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 9, 2013 at 9:57 | vote | accept | frrlod | ||
| May 9, 2013 at 9:46 | comment | added | Quentin |
No. Quote marks delimit the start and end of a string literal (in both PHP and JavaScript). They aren't part of the string, they just contain it. If they were, then you would have " characters showing up every time you tried to print anything in PHP, which would be awful.
|
|
| May 9, 2013 at 9:43 | comment | added | frrlod | I don't understand one thing. $race IS a string. Say it contains "human". Then wouldn't value_of_race be "human", already with quotes, rather than just human? | |
| May 9, 2013 at 9:39 | comment | added | Quentin |
@Waygood — Yes, but Jace's code doesn't do that (and your comment doesn't provide any code to do the escaping). Mine does (although it uses " instead of ').
|
|
| May 9, 2013 at 9:30 | comment | added | Quentin |
@Jace — That will break if the string contains ' characters.
|
|
| May 9, 2013 at 9:29 | comment | added | Jace | ie. document.write(capitalizeFL('".$race."')); | |
| May 9, 2013 at 9:28 | history | answered | Quentin | CC BY-SA 3.0 |