Basics:
The PHP portion of code looks like this:
< ? php
? >
Each line of code is ended with " ; "
To declare a variable with PHP you declare it as you need it. This is done with a " $ "
Example: $txt = "Hello World!";
PHP will automatically assign the variable a type: string, integer etc.
Putting a (.) into a line of code will concat two variables. Example:
< ? php
$txt1="Hello World";
$txt2="1234";
echo $txt1 . " " . $txt2;
? >
The output of the code above will be:
Hello World 1234
Other Functions:
Strlen: finds string length
echo strlen("Hello world!");
Strpos: finds specified string in another string:
< ? php
echo strpos("Hello world!","world");
? > The output of the code above will be: 6
Monday, 22 October 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment