Posts Tagged ‘Eliminate duplicate characters’

Bulk "One Line" PHP scripts

Below scripts will be more useful for PHP developers to make their coding fast and efficiency. 1) Eliminate duplicate (or more) characters in a string (the underscore in the example below): $text = preg_replace(‘#(_)+#’,'_’,$text); 2) Randomly select of one element out of an array: $image = $image_array[array_rand($image_array)]; 3) Pass the htaccess/htpassword authenticated user to a [...]