Skip to content

Instantly share code, notes, and snippets.

@ravinsharma12345
Created August 17, 2013 05:05
Show Gist options
  • Save ravinsharma12345/6255371 to your computer and use it in GitHub Desktop.
Save ravinsharma12345/6255371 to your computer and use it in GitHub Desktop.
php in z minutes
<?php
//This is a s comment
/**
This is a block comment
**/
print("Outputing some strings");
echo "Echoing some strings and string formatter\n";
$boolean = true; // boolean
$int1 = 12; // This is an integer
$int2 = -12; // We can put negative integers also
$int3 = 012; // this is a octal value, 0 in front means octal value
$int4 = 0x0F; // This is hex value, 0x
$float = 1.234; // doubles or float, i know its floating points
$float = 1.23e10; // This is for exponents, e means decimal points
$float = 7E-10; // This is the same
$sum += 1 ; //$sum = $sum + 1
$difference -= 1; //$difference = $difference - 1
$product *= 1; //$product = $product * 1
$quotient /= 1; //$quotient = $quotient / 1
$number = 0;
$number++;
echo $number++;
echo ++$number;
$dbl_quotes = "This is a string";
$dbl_quotes = 'This is also a string';
$dbl_quotes = "This is a $number";
$dbl_quotes = "This is a complex string $${number}";
$nowdoc = <<< 'END'
Multiline string
END;
$heredoc = <<< END
Another Multiline
$sql_quotes
END;
define("FOO", "something") // a constant FOO with value something
echo 'This is a ' . 'string conatenation';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment