This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
uphp:uphp_language_basics [2017/02/12 10:51] jeff created |
uphp:uphp_language_basics [2021/09/13 05:57] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== uPHP Language Basics ====== | + | ======uPHP Language Basics====== |
The following sections describe how to work with uPHP scripts. | The following sections describe how to work with uPHP scripts. | ||
- | ===== uPHP Tags ===== | + | =====uPHP Tags===== |
- | + | When [[hardware: | |
- | When Wattmon parses a file, it looks for opening and closing tags, which are ''<?'' | + | |
<code php> | <code php> | ||
Some text | Some text | ||
<? | <? | ||
- | print(‘hello, | + | |
?> | ?> | ||
Some more text | Some more text | ||
</ | </ | ||
- | In addition, you can integrate multiple code blocks | + | In addition, you can integrate multiple code blocks |
- | <code php><? | + | <code php> |
- | + | <? | |
- | If ($mycondition > 5) { | + | If ($mycondition > 5) { |
- | ?> This will only be output if my condition > 5 | + | ?> This will only be output if my condition > 5 <? |
- | <? } else { ?> | + | |
- | This will be output if the first condition is not true. | + | |
- | <? } ?> | + | |
+ | ?> | ||
</ | </ | ||
- | ===== Instruction Separation ===== | + | =====Instruction Separation===== |
As in C and PHP, uPHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of uPHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a uPHP block. The closing tag for the block will include the immediately trailing newline if one is present. | As in C and PHP, uPHP requires instructions to be terminated with a semicolon at the end of each statement. The closing tag of a block of uPHP code automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a uPHP block. The closing tag for the block will include the immediately trailing newline if one is present. | ||
- | ===== Comments ===== | + | =====Comments===== |
uPHP supports ' | uPHP supports ' | ||
- | <code php><? | + | <code php> |
- | // comment 1 | + | <? |
- | $x=1; | + | // comment 1 |
- | #comment2 | + | $x=1; |
- | $x=2; | + | # comment2 |
- | print($x); | + | $x=2; |
- | /* comment 3 */ | + | print($x); |
- | $x=3; | + | /* comment 3 */ |
- | print($x); | + | $x=3; |
+ | print($x); | ||
?> | ?> | ||
</ | </ | ||
- | The " | + | The " |
' | ' | ||
- | <code php><? | + | <code php> |
+ | <? | ||
/* | /* | ||
- | | + | echo 'This is a test'; /* This comment will cause a problem */ |
- | */ ?> | + | echo 'Print this also'; |
+ | */ | ||
+ | ?> | ||
</ | </ | ||
- | ===== Programmer Reference ===== | + | =====Programmer Reference===== |
+ | |||
+ | * [[functions|uPHP Function Reference]] - The entire function list (advanced) | ||
- | * [[functions: | + | * [[uPHP Special Variables]] |
- | * [[wiki:uPHP Special Variables|uPHP Special Variables]] | + | |