php: two objects from the same class work independent of each other

Posted by user317563 on Stack Overflow See other posts from Stack Overflow or by user317563
Published on 2010-05-04T14:20:31Z Indexed on 2010/05/04 14:28 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

Good morning,

I would like the code in my controller to look something like this:

<?php
$class = new sanitizeInput()

$string1 = $class -> input($_POST[name]) -> mysql_escape();
$string2 = $class -> input($_POST[age]) -> mysql_escape();

print "
     String1: $string1 <br />
     String2: $string2"
?>

It seems with my sanitizeInput class, any change to $string2 is applied to $string1. What ways can I change this? I would preferably like to make the changes within the class to make my controller as easily read as possible.

Thank you for your time.

Kind regards,
Marius

© Stack Overflow or respective owner

Related posts about sanitization

Related posts about clone