xslt-config not found. Please reinstall the libxslt >= 1.1.0

The error “xslt-config not found. Please reinstall the libxslt >= 1.1.0” is occurred if  libxslt is not installed or due to lower version. I have try many things to solve that error and finally I solved by installing hight version like below. sudo apt-get install libxslt1-dev see no where it is mansion that  you need to install it “libxslt1-dev” but after

Read more

php check valid username

You can check username is valid or not using regular expression.Regular expression is strong part of php.You can also use perl style of regular expression in php.The bellow given php function will allow only alpha numeric and underscore character.You can free to use this function in your project or scripts. Function function validate_username($username) { return preg_match(‘/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/’,$username); }

Read more

php remove newline from string

You can remove new line character any where in string using regex preg_replace.preg_replace is function which work on regex to search and replace in string.Regular express is strong part of php.You can also search replace html tags.Here I have used regex string feature to search and replace new line character. Here is example how you can remove new line anywhere

Read more

php submit form to self

Submitting form to self page is easy.Just what you have to do is set form action method to blank.Leaving form action blank will submit form to itself. For submitting php form itself keep your php code to top of php page and php html form code to bellow your php code.In your php code a top please use isset($_POST) condition

Read more

php remove from array

This is very simple in php.There is function called “unset()”.Which You can use to remove array element.what you have to do is pass array name and element key to which you want to remove. here is just simple example $arr=array(0=>’string1′,1=>’string2′,3=>’string3′); unset($arr[1]); //will remove second element from array

Read more

php remove space inside string

You can remove space any where in string using regex preg_replace.preg_replace is function which work on regex to search and replace in string.Regular express is strong part of php.You can also search replace html tags.Here I have used regex string feature to search and replace space. Here is example how you can remove space anywhere in php $str = ‘nik

Read more

php get root path

$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some. You can get root path in php using $_SERVER[‘DOCUMENT_ROOT’]. What is $_SERVER[‘DOCUMENT_ROOT’] ? The document root directory under which

Read more

php get date from timestamp

Its very easy in php to convert any valid timestamp value to php date time.The date() function and getdate() function do exactly what you required.here I am presensting some of example how to convert valid timestamp to php //php_get_date_from_timestamp.php $timestamp=time()-86400; //This is for just example Previouse day timestamp $date=date(“m/d/Y h:i:s A'”,$timestamp); echo $date; //another Way $DateArr=getdate($timestamp); echo $DateArr[‘mon’].’/’.$DateArr[‘mday’].’/’.$DateArr[‘year’].’ ‘.$DateArr[‘hours’].’:’.$DateArr[‘minutes’].’:’.$DateArr[‘seconds’] ;

Read more

php get url parameters

If you are looking for get url parameters in php then no need to write any logic or condition for getting it.Php has in built function called as “parse_url” this function return as array with parameter like host,path,query,fragment and more options.For more explanation please refer bellow given example. $url = ‘http://www.my-php-scripts.net/index.php?arg=value&args2=dfsdfsf#anchor’; print_r($url); This will return following Array ( [scheme] =>

Read more

php get filename without extension

If you are looking for how to get filename without extension then there is no need to do any coding or any logic for getting filename without extension simply you can use the php inbuilt function “pathinfo”.This function will return array with file info like extension,Filename without extension,Basename etc.For more info please refer bellow given example. $path_parts = pathinfo(‘/www/htdocs/index.html’); echo

Read more
1 2