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 | |
$a = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); | |
$new_a = array_map('square', $a); | |
var_dump($a, $new_a); | |
function square($temp){ | |
return ($temp * $temp); | |
} |
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 | |
$a = array(); | |
for ($i=0; $i < 3; $i++) { | |
array_push($a, $i); | |
var_dump($a); | |
} | |
for ($i=0; $i < 3; $i++) { | |
array_pop($a); |
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 | |
$a = array( | |
'x' => 'X', | |
'xx' => 'XX', | |
'xxx' => 'XXX' | |
); | |
var_dump(array_keys($a)); | |
// RESULTS |
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 | |
$a = array( | |
'1' => 'one', | |
'one' => 'one', | |
'2' => 'two' | |
); | |
var_dump($a); | |
var_dump(array_unique($a)); |
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 | |
$name = 'James'; | |
$surname = 'Pond'; | |
$job = 'Failure'; | |
$temp = array('name', 'surname'); | |
$result1 = compact($temp, 'job'); | |
$result2 = compact($temp[0], $temp[1], 'job'); |
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
if(window.location.pathname === 'index.php'){ | |
// do something | |
} |
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 | |
if(isset($_POST['submit'])){ | |
echo $_POST['text'] . ' got submitted.'; | |
}else{ | |
?> | |
<form action="self_exec.php"> | |
<fieldset> | |
<input type="text" name="text" value="text" placeholder="Type here..."> | |
<input type="submit" name="submit" value="Submit"> | |
</fieldset> |
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 | |
// db info | |
$db_host = 'localhost'; // local only connection | |
$db_port = 3306; // default mysql port | |
$db_database = 'db_user'; // database username | |
// initiate dns string | |
$dns = "mysql:host=$db_host;port=$db_port;dbname=$db_database"; | |
// create database object or close 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 | |
// inside included file | |
defined('INCLUDE') or die('No direct access allowed.'); | |
?> | |
<?php | |
// inside includer | |
define('INCLUDE', 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
javascript:void((function(){var%20d=document;d.write('<!DOCTYPE%20html><html><head><meta%20charset="UTF-8"><title>'+d.title+'%20-%20Responsive%20test</title><link%20rel="stylesheet"%20href="http://responsive.victorcoulon.fr/assets/css/app.css"><script%20src="http://responsive.victorcoulon.fr/assets/js/app.min.js"></script></head><body><header><div%20class="close"><a%20href="#">%C3%97</a></div><div%20id="size"></div><div%20id="devices"><a%20href="#"%20class="tablet-portrait"><span>Tablet%20Portrait</span></a><a%20href="#"%20class="tablet-landscape"><span>Tablet%20Landscape</span></a><a%20href="#"%20class="smartphone-landscape"><span>iPhone%20Landscape</span></a><a%20href="#"%20class="smartphone-portrait"><span>iPhone%20Portrait</span></a><a%20href="#"%20class="auto%20active"><span>Auto</span></a></div></header><section><iframe%20id="wrapper"%20src="'+d.URL+'"%20onLoad="resbook.changeUrl(this.contentWindow.location,this.contentDocument.title);"></iframe></section></body></html>')})()); | |
<!-- http://responsive.v |