Latest Post

Error: No input file specified.

While trying to run a codeigniter app the other day I came across this error just after I had finished uploading the files and making the ne...

Friday, June 26, 2009

Javascript: search for a string withing another string

//In this example i'm using regular expressions

var myRegExp = /find me/;
var string1 = "can you find me in this string?";
var matchPosition = string1.search(myRegExp);

if(matchPosition != -1){
//match was found on position matchPosition
}else{
//not found in string
}

Tuesday, June 2, 2009

How to print the contents of a php page into a variable

// To get the generated HTML
$source = file_get_contents("http://domain.net/path/to/script.php");

// To get everything including PHP source
$source = file_get_contents("/path/to/script.php");

Chitika Ads