#native_company# #native_desc#
#native_cta#

The Slasher

By Lee Davis
on April 12, 2002

Version: .01

Type: Function

Category: HTML

License: Other

Description: This function removes ALL backslashes from any given variable. It should work with PHP3 and PHP4. It can be used in place of the native stripslashes() function.

<?
/*
-------------{ developed by L Davis - [email protected] }--------------

DESCRIPTION:
  This function removes ALL backslashes from any given variable. It 
  should work with PHP3 and PHP4. It can be used in place of the 
  native stripslashes() function.

USAGE:
  slasher($any_variable);
    Place the function code at the top of your PHP page or place it
    in an include file. Call it from anywhere within the page.

    USE THIS CODE AT YOUR OWN RISK - THERE EXISTS NO EXPRESSED OR IMPLIED
    GUARANTEE!


    -{ WARNING - THIS FUNCTION REMOVES ALL BACKSLASHES - WARNING }-
      (if you need to leave a backslash, DO NOT use this function) 

--------------------- BEGIN FUNCTION DECLARATION ----------------------
*/
function slasher($origin)
{
// Variable declaration and initialization
  $element  = ""; // Holds the variable passed to the function
  $num      = ""; // Holds the number of array elements 
  $slash_it = ""; // The return variable

// Break the variable into an array containing separate elements 
// using a backslash as the delimiter  
  $element = explode("", $origin);
// Get the number of elements in the array
  $num = count($element);
// Use the for loop to iterate through the array  
  for($inc=0; $inc<=$num; $inc++)
  {
  // Concatenate the elements into $slash_it
    $slash_it = $slash_it . $element[$inc];
  }
// Return the new value with the slashes removed  
  return $slash_it;
}
/* 
--------------------- END FUNCTION DECLARATION ------------------------

  -{ WARNING - THIS FUNCTION REMOVES ALL BACKSLASHES - WARNING }-
    (if you need to leave a backslash, DO NOT use this function) 

-----------------------------------------------------------------------
                           BEGIN EXAMPLE 
----------------------------------------------------------------------- 
*/
$any_variable = "function\'s";
?>
<html>
  <head>
	  <title>Untitled</title>
  </head>
  <body>
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
      <tr>
        <td align="center">
          <br><br>
          <font color="#666666" size="4" face="Verdana, Arial, Helvetica"><b>- The Slasher -</b></font>
          <br>
          <font color="#666666" size="1" face="Verdana, Arial, Helvetica">This function is for use with PHP. It removes backslashes from any  <br>given variable. You can use this in place of the <b>stripslashes</b>() function.</font>
          <br><br>
          <font color="#666666" size="2" face="Verdana, Arial, Helvetica"><b>Before The Slasher:</b> This <?echo $any_variable;?> function is to remove the backslashes from any given variable.</font>          
          <br><br>
          <font color="#666666" size="2" face="Verdana, Arial, Helvetica"><b>After The Slasher:</b> This <?echo slasher($any_variable);?> function is to remove the backslashes from any given variable.</font>
          </td></tr>
    </table>
  </body>
</html>