Type the following command in terminal to See apache log error in Ubuntu smarttips@smarttips-System-Product-Name:~$ tail -f /var/log/apache2/error.log
Category: PHP
php zendframework truncate a string function
The programmers can use this <h4>truncate function in php zend framework</h4> to limit the string length <?php echo $mysmartcode = $this->string()->truncate(‘ i love u’, 5); ?>
function to remove trailing slashes from URL
php function to remove trailing slashes from URL <?php private function _curSiteURL() { $pageURL = ‘http’; if ($_SERVER[“HTTPS”] == “on”) {$pageURL .= “s”;} $pageURL .= “://”; $pageURL .= $_SERVER[“SERVER_NAME”].dirname($_SERVER[‘SCRIPT_NAME’]).’/’; if (substr($pageURL, -1) == ‘/’ ): return substr($pageURL, 0, -1); else: return $pageURL; endif; } ?>
php str_replace() function
php str_replae() function echo $socUrl = str_replace(‘-‘, ‘smarttips.in’, ‘My favorite website is -‘); output-My favorite website is smarttips.in
PHP foreach loop key value
PHP foreach loop key value foreach($data as $key => $value): echo $key; echo $value; endforeach; Example: <?php foreach($this->universities as $key => $value): if($key == $group->group_id): echo $value; endif; endforeach; ?>