RYAN'S WEBSITE

Just something small and tiny.

Held by Ryan Ruoshui Yan.


Here is the world of a nerdy guy.

Visited:

PHP Notes

How to embed PHP?

  • Default
<?php
    ...;
?>
  • Simplified (Need to be turned on)
<? ?>

<?= ?>

<% %>

How to print?

echo "Hello World";
// Note: Can use HTML tags inside
echo "<br>";

How to create var?

$var = "Hello";
// Note: Can use HTML tags inside
$var = "<h1>Hello</h1>";

Comment

// One line comment

/*
    Multiple line comment
*/

Concatenation (String)

  • Dot
"Hello" . "World"

Array

array("value")

Associative Array (Dictionary)

array("key" => "value")

Keyword: foreach

foreach ($arr as $item)

Constant

define("NAME", "Ryan");
// Note: The constant is ALL CAPITAL, and it has quotes around it.
echo NAME;
// Note: When calling the constant, it does not have quotes around it.

Math

  • Power
    • pow()

Array (Existence of an item)

  • in_array($item, $array)

post

$_POST

Existence

isset()

Form

<?php
    if (isset($_POST['submit'])) {
        echo "Submit pressed." . "<br>";
        echo $_POST['username'] . "<br>";
        echo $_POST['password'] . "<br>";
    }
 ?>

 <form class="" action="<nameOfThisFile>.php" method="post">
     <input type="text" name="username" placeholder="Username">
     <input type="password" name="password" placeholder="Password">
     <input type="submit" name="submit">
 </form>
RECENT

SQL Notes

Create databaseCREATE DATABASE <database_name>Delete (Drop) databaseDROP DATABASE <database_name>…

MORE
EARLIER

Haskell Notes

Disclaimer: The notes below are fully/partially NOT created by myself. They are from slides and/or wikipedia and/or textbook. The purpose of this post is simply to learn and review for the course. If you think something is inappropriate, please co...…

MORE