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 User | |
{ | |
protected $createdAt; | |
protected $name; | |
public function __construct($name, DateTime $createdAt) | |
{ | |
$this->name = $name; |
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> | |
<body> | |
<form> | |
<select name="courses" id="courses"> | |
<option value="">Select a course</option> | |
<option value="1">JavaScript</option> | |
<option value="2">PHP</option> | |
<option value="3">HTML & CSS</option> |
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 | |
//Count the records in your database | |
//SELECT COUNT(*) FROM .... | |
$records = array( | |
array('name' =>'Richard Feynman', 'age' => 30), //You already have this one in your HTML | |
array('name' =>'Erwin Schrödinger', 'age' => 31), | |
array('name' => 'Albert Einstein', 'age' => 32), | |
); | |
$count = filter_var($_GET['recordsCount'], FILTER_VALIDATE_INT); |
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 | |
$url = 'https://www.somedomain.com/a-page'; | |
$certificateFile = 'ceritificate.pem'; | |
$certificatePassword = 'password'; | |
$handler = curl_init(); | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, | |
CURLOPT_FOLLOWLOCATION => true, |
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
CREATE TABLE user ( | |
user_id INT NOT NULL AUTO_INCREMENT, | |
name VARCHAR(256) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NOT NULL, | |
PRIMARY KEY (user_id) | |
) ENGINE = InnoDB | |
DEFAULT CHARACTER SET = utf8 | |
COLLATE = utf8_general_ci; | |
CREATE TABLE user_friends ( | |
user_id INT NOT NULL, |
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 | |
$array = array('pedro', 'juan', 'paco', 'pedro'); | |
$repeated = array_filter(array_count_values($array), function($count) { | |
return $count > 1; | |
}); | |
foreach ($repeated as $key => $value) { | |
echo "Key '$key' is repeated $value times <br />"; | |
} |
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 | |
// /tests/functional/Application/DataFixture/VenueTypeFixture.php | |
namespace Application\DataFixture; | |
use \Doctrine\DBAL\Connection; | |
class VenueTypeFixture | |
{ | |
protected $connection; |
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 | |
$now = new DateTime('now', new DateTimeZone('America/Mexico_City')); | |
$twoHoursAgo = clone $now; | |
$twoHoursAgo = $twoHoursAgo->sub(new DateInterval('PT2H')); | |
$diff = $now->diff($twoHoursAgo); | |
echo $diff->format("%H hours\n"); |
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
function CreateAjax() { | |
var objetoAjax = false; | |
try { | |
/* Para navegadores distintos a Internet Explorer */ | |
objetoAjax = new ActiveXObject("Msxml2.XMLHTTP"); | |
} catch (e) { | |
try { | |
/* Para explorer */ | |
objetoAjax = new ActiveXObject("Microsoft.XMLHTTP"); | |
} catch (E) { |
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
{ | |
"name": "drupal/drupal", | |
"description": "Drupal is an open source content management platform powering millions of websites and applications.", | |
"type": "drupal-core", | |
"license": "GPL-2.0+", | |
"repositories": [ | |
{ | |
"type": "vcs", | |
"url": "https://github.com/MontealegreLuis/DrupalAppConsole.git" | |
} |
OlderNewer