I have a javascript that says the following: function twerk($a, $b) { $hash = this._getHash($a, $b); this.toString = function() { return $hash; } } How do I convert this to PHP??? Help!!!
I guess you are asking about toString() equivalent in php - it is __toString() function. class fwerk { private $hash; public function __construct($a,$b) { $this->hash = $this->_getHash($a,$b); } public function _getHash($a,$b) { //generate hash $this->hash = some_function($a,$b); } public function __toString() { return $this->hash; } } PHP: I guess your javascript is only a part of some bigger class, so to completely convert it to php we _getHash function definition.
better will understand what this function to do or what you need to do and write new script than convert this