Архиви на блога

search for short open tags

If you use Linux and try to search for all php files containing short open tags you can use following command find -type f -exec grep -IlP ‘<\?(?!(php|xml|=))’ {} +

С етикет: , ,
Публикувано в linux, php

php recursive delete

This function do recursive delete on files and folders in php function recursiveDelete($str){ if(is_file($str)){ return @unlink($str); } elseif(is_dir($str)){ $scan = glob(rtrim($str,’/’).’/*’); foreach($scan as $index=>$path){ recursiveDelete($path); } return @rmdir($str); } }

С етикет: , , ,
Публикувано в linux, php

php post with big array

Starting from php 5.3.9 there is brand new config option max_input_vars which is limiting the input variables to posted arrays and etc. max_input_vars integer How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal

С етикет: , , , ,
Публикувано в linux

strip first words from a string

<?php echo implode(‘ ‘, array_slice(explode(‘ ‘, strip_tags($introtext) ), 0, 30));?> …

С етикет: , , ,
Публикувано в Joomla

preg_match_all image

$matches = array(); preg_match_all(‘/<img.+src=[\’“]([^\’“]+)[\’“].*\/>/i’ , $article->text , $matches); if($matches[0][0]){ echo $matches[0][0]; }

С етикет: , , , , ,
Публикувано в Joomla