Created
November 14, 2010 00:58
-
-
Save wowo/675789 to your computer and use it in GitHub Desktop.
Easy way of removing new lines in every attribute of an object - with closures in PHP 5.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Operation | |
{ | |
public $dateOperation; | |
public $datePosting; | |
public $type; | |
public $description; | |
public $priceOriginalCurrency; | |
public $pricePln; | |
public function removeNewLines() | |
{ | |
array_walk($this, function(&$value) { | |
$value = str_replace("\n", "", $value); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment