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 -v | |
PHP 5.3.6 (cli) (built: Mar 17 2011 20:58:15) | |
Copyright (c) 1997-2011 The PHP Group | |
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies | |
# echo '<?php $s = array(); for($x=0;$x<1000;$x++){ $s[] = array("name"=>"Adam","age"=>35); }; echo memory_get_peak_usage(); ' | php | |
655040 | |
# echo '<?php $s = array(); for($x=0;$x<1000;$x++){ $o = new ArrayObject; $o->name = "Adam"; $o->age = 35; $s[] = $o;} echo memory_get_peak_usage(); ' | php | |
887984 |
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
// Adapted from: http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect/1968345#1968345 | |
function line_intersects(p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) { | |
var s1_x, s1_y, s2_x, s2_y; | |
s1_x = p1_x - p0_x; | |
s1_y = p1_y - p0_y; | |
s2_x = p3_x - p2_x; | |
s2_y = p3_y - p2_y; | |
var s, t; |