This is probably a very simple question, but I just can't figure it out. I want to define a string containing two forward slashes
$htmlcode="text//text";
From what I understand what follows after // are comments.
Question: How do create a string containing //?
Parsing of the language is a little bit tricky. Within a string literal, comments and other language features are not triggered (except for special characters which need to be escaped). Also, within block comments, line-comments are not valued.
$example1 = 'hello /* this is not a comment */ '; /* but this is */
$example2 = 'hello // this is not a comment '; //but this is
$example3 = "works the same with double quotes /* not a comment */ //not a comment ";
/* comment example
$thisIsAComment
//this does not escape the closing */
$htmlcode="text//text"; //this is comment.
Your string is already defined as you want it to be. Check out docs: http://php.net/manual/en/language.basic-syntax.comments.php
You should use some IDE or syntax highlighter, you will understand code more clearly. Notepad++ is free and lightweight http://notepad-plus-plus.org/download
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With