method add documentation in bbn\Str\Hash
function($pair, $replace = 1)
{
if ( \is_array($pair) )
{
if ( isset($pair[0]) && isset($pair[1]) )
{
$k = $pair[0];
$v = $pair[1];
}
else
{
$k = array_keys($pair);
$k = $k[0];
$v = $pair[$k];
}
if (
preg_match('#[A-z0-9_]+#',$k,$m) === 1 &&
$m[0] === $k &&
preg_match('#[A-z0-9_]+#',$v,$m) === 1 &&
$m[0] === $v
)
{
if ( is_numeric($v) )
$v = $v + 0;
$i = array_search($k,$this->keys);
if ( $i === false )
{
array_push($this->keys,$k);
array_push($this->values,$v);
}
else if ( $replace )
{
$this->keys[$i] = $k;
$this->values[$i] = $v;
}
return $this;
}
}
return false;
}
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions