Thursday, February 24, 2011

Strip All Non Alphanumeric Characters Except Space With PHP

<?php
$string_to_be_stripped = "Hi, I am a string and I need to be stripped...";
$new_string = ereg_replace("[^A-Za-z0-9]", "", $string_to_be_stripped );

function alphanumericAndSpace( $string )
{
return preg_replace('/[^a-zA-Z0-9\s]/', '', $string);
}
echo alphanumericAndSpace( $string_to_be_stripped);
?>

Yii2 mongo db group by count example

$collection = Yii::$app->mongodb->getCollection('collectionname');         $callingstationidCount = $collection->aggregat...