Archive for the ‘PHP’ Category

class in php

Tuesday, November 18, 2008 9:32 No Comments

Class is nothing but binding the data. I’e variables and functions. In class we can have number functions. Class can be declare with a key word class followed by a class name, which can be any name. This name should not be key word in php. Followed by a pair of curly braces . Its [...]

This was posted under category: PHP Tags: , , ,

trim() in php

Tuesday, November 11, 2008 10:53 No Comments

If you use a form on your site then you’ll know that user input can often have white space before or after the text as the person filling in the form field sometimes accidentally adds spaces. This handy function will remove the whitespace from the beginning or end of the string. < ?php echo trim($_REQUEST['name']); [...]

This was posted under category: PHP

Using curl functions in php to send sms for smaple sms gateway

Saturday, November 8, 2008 11:42 14 Comments

This is a sample code assuming we have a sms gateway with name smsgateway.co.cc. We have take a sample $curlPost = ‘Mobile_No=9000099119&Type=SMS&Message=”This is a test message”‘; //we have to pass the mobile number and message as argument to the url. $LOGINURL = “http://smsgateway.co.cc/UserMiscellaneousMT.asp”; //This url will be provided by our gateway $agent = “Mozilla/5.0 (Windows; U; [...]

This was posted under category: PHP, Programming Tags: , , , , , , , , , ,

count() in php

Saturday, November 8, 2008 11:29 No Comments

The count() function is useful when you want to return how many elements are in your array. You can then use this in a for loop. Here’s an example we used earlier, only this time with the count function: $a[0]  = 2; $a[5]  = 3; $a[10] = 6; $totalsize = count($a); for($i=o;$i< $totalsize;$i++){ echo $totalsize[$i]; }

This was posted under category: PHP, Programming Tags: , ,

round () in php

Wednesday, November 5, 2008 23:41 No Comments

The PHP function round () is used to round numbers up or down based on their value (Any decimal .5 or above is rounded up, anything under .5 is rounded down.) by default it will round to the nearest whole number < ?php echo (round(0.70) . ""); echo (round(0.50) . ""); echo (round(0.20) . ""); [...]

This was posted under category: PHP, Programming Tags: ,