Top Left Text cha

Website Development Services

I used this specifically to combat a problem with file downloads - when the user uploads them and adds special characters like '#', '?', etc.  Just a PHP preg_replace function, which uses RegEx...

$url = preg_replace("![^a-z0-9]+!i", "-", $url);

excl!hash## !@#$%^&().pdf becomes excl-hash-.pdf

You can replace the dash with nothing like below and it will just smash everything around the special characters together...

$url = preg_replace("![^a-z0-9]+!i", "-", $url);
excl!hash## !@#$%^&()d.pdf becomes exclhash.pdf
For me it was a little more complicated as it was a file upload that needed changed.  So I used the code below...

$uploadChunks = pathinfo($_FILES['upload']['name']);
$upload = preg_replace("![^a-z0-9]+!i", "-", $uploadChunks['filename']).'.'.$uploadChunks['extension'];
Comment (0) Hits: 61

Found this at Stack Exchange... very handy!

    <form name="car_form" method="post" action="doublevalue_action.php">
            <select name="car" id="car">
                    <option value="">Select Car</option>
                    <option value="BMW|Red">Red BMW</option>
                    <option value="Mercedes|Black">Black Mercedes</option>
            <input type="submit" name="submit" id="submit" value="submit">

PHP action:

            $result = $_POST['car'];
            $result_explode = explode('|', $result);
            echo "Model: ". $result_explode[0]."<br />";
            echo "Colour: ". $result_explode[1]."<br />";
Comment (0) Hits: 575




void var_dump ( mixed $expression [, mixed $... ] )

This function displays structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to show structure.

In PHP 5 all public, private and protected properties of objects will be returned in the output.

Comment (0) Hits: 1150
       echo "I'M SORRY... YOU HAVE AN IPAD!!!";
	else {
		echo "YOU DO NOT HAVE AN IPAD!!!";


Comment (0) Hits: 1246
   $search-string = "derpity derp";
   $arr = array("", "", "");
   foreach ($arr as $site) {
      $contents = file_get_contents($site);
      if ( strpos($contents, $search-string) !== false ) {
         echo "$site - code found.<br />';

Comment (0) Hits: 1242