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
/$: include '/home/rolands/Public/Web/regexvsstrpos.php' | |
# Return | |
int(1) | |
/$: test_test_valid_strpos('some string goes here that is valid') | |
# Return | |
float(10.26731300354) |
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 | |
function test_valid_strpos($s) { foreach(array(';', ',', '|', '[', ']') as $c) if(false !== strpos($s, $c)) return false; return true; } | |
function test_valid_regex($s) { return preg_match('/[;,|\[\]]/', $s) === 0; } | |
function test_valid_strpbrk($s) { return false === strpbrk($s, ';,|[]'); } | |
function test_test_valid_strpos($s) { $t = microtime(true); for($i = 0; $i < 1000000; $i++) test_valid_strpos($s); return (microtime(true) - $t); } | |
function test_test_valid_regex($s) { $t = microtime(true); for($i = 0; $i < 1000000; $i++) test_valid_regex($s); return (microtime(true) - $t); } | |
function test_test_valid_strpbrk($s) { $t = microtime(true); for($i = 0; $i < 1000000; $i++) test_valid_strpbrk($s); return (microtime(true) - $t); } |
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 DB { | |
public static function insert($table, $properties) { | |
// izveido SQL un izpildi | |
} | |
} | |
class Model { | |
public function __construct($properties) { | |
foreach($properties as $property_name => $property_value) |
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 http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>HTML5 'pushState' History Example</title> | |
<script type="text/javascript" charset="utf-8"> | |
var original = document.location.href; | |
history.pushState({ | |
isFakeHistory: true, | |
fakeHistoryURL: "fake-history.html" |