Skip to content

Instantly share code, notes, and snippets.

View FinchPowers's full-sized avatar

François-Michel L'Heureux FinchPowers

View GitHub Profile
<?php
function find($type = 'first', $query = array()) {
if(isset($query['conditions']) && (array_key_exists('MiscIdentifier.identifier_value >=', $query['conditions']) || array_key_exists('MiscIdentifier.identifier_value <=', $query['conditions']))) {
$gt_key = array_key_exists('MiscIdentifier.identifier_value >=', $query['conditions']);
$lt_key = array_key_exists('MiscIdentifier.identifier_value <=', $query['conditions'])
// do we really need to work with decimals?
$inf_value = str_replace(',', '.', ($gt_key ? $query['conditions']['MiscIdentifier.identifier_value >='] : ''));
$sup_value = str_replace(',', '.', ($lt_key ? $query['conditions']['MiscIdentifier.identifier_value <='] : ''));
if(strlen($inf_value.$sup_value) && (is_numeric($inf_value) || !strlen($inf_value)) && (is_numeric($sup_value) || !strlen($sup_value))) {
if($gt_key)) {