php invalid argument in foreach supplied -
i cannot life of me figure out why error being thrown...i supplying valid array , basic loop
php
class stats { private $resirictedchars = array('@', '(', ')', '"', '<', '>', ',', '?', ':', ';', '[', ']', '{', '}'); function __construct() {} public function generatestats ($text) { foreach ($this->restrictedchars $char) { $text = str_replace($char, '', strtolower($text)); } echo $text; } } $run = stats::generatestats('hello.');
error
warning: invalid argument supplied foreach()
typo in variable names, $resirictedchars
v/s $restrictedchars
.
Comments
Post a Comment