Skip to content

Instantly share code, notes, and snippets.

View filippomangione's full-sized avatar

Filippo Mangione filippomangione

  • Boolean Careers
  • Milano
View GitHub Profile
@filippomangione
filippomangione / validateGeoCoords.php
Last active June 24, 2019 17:24
A simple function to validate latitude and longitude in php.
<?php
function validateGeoCoords($lat=null,$lng=null) {
return (trim($lat,'0') == (float)$lat) && (trim($lng,'0') == (float)$lng);
}
@filippomangione
filippomangione / array_pluck.php
Created May 4, 2014 10:06
An equivalent to Underscore.js pluck method.
<?php
$stooges = [
["name" => "Moe", "age" => 40],
["name" => "Larry", "age" => 50],
["name" => "Curly", "age" => 60],
];
function array_pluck ($toPluck, $arr) {
return array_map(function ($item) use ($toPluck) {