This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Odd and even counter | |
*/ | |
$odd = $even = 0; | |
$given = 20; | |
for ($i=0;$i<$given;$i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Friends | |
{ | |
function jared($name = null) { | |
return "My name is $name"; | |
} | |
} | |
$friend = new Friends(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getOrderList() { | |
if ( ! empty( $_SESSION['userSession'] ) ) { | |
$values = array( ":uid" => $_SESSION['userSession'] ); | |
$stmt = $this->conn->prepare("SELECT * FROM tbl_orderlist WHERE CustomerID = :uid"); | |
$stmt->execute($values); | |
$row = $stmt->fetchAll(); | |
// Uncomment this to debug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Test</title> | |
</head> | |
<body> | |
<ul> | |
<li><a href="javascript:;" onclick="fr(1)">1</a></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$i = 0; | |
$num = []; | |
while($i<100) { | |
$num[] = $i++; | |
} | |
shuffle($num); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = 'title:{1-2 Bedrooms Apartment for Rent}:description:{1 Bedroom: $700/month / 2 Bedroom: $900/month<br />Bedrooms:1<br />Bathrooms:1<br />Floor:E6<br />LD329<br />http://www.lambdakh.com/.../apartment-for-rent-in.../<br type="_moz" />}:meta_title:{}:meta_key:{}:meta_des:{}:'; | |
$explode = explode("}:", $str); | |
foreach ($explode as $val) { | |
if (empty($val)) { | |
continue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// save post values to a variable | |
$username = $_POST["username"]; | |
$password = $_POST["password"]; | |
// create array | |
$userdata = [ | |
"username" => $username, | |
"password" => $password | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$database = "exercise"; | |
$username = "root"; | |
$password = ""; | |
$conn = new PDO("mysql:host=$servername;dbname=$database;charset=utf8mb4", $username, $password); | |
$fullname = 'Jaylord Ferrer'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$database = "exercise"; | |
$username = "root"; | |
$password = "root"; | |
$connection = new PDO ("mysql:host=$servername;dbname=$database;charset=utf8mb4", $username, $password); | |
/* End of file */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$host = "localhost"; | |
$database = "mydb"; | |
$username = "root"; | |
$password = ""; | |
try { | |
$connection = new PDO("mysql:host=$host;dbname=$database;charset=utf8", $username, $password); | |
} catch(PDOException $e) { |
OlderNewer