Archive for October 2011

Getting Started with NetBeans IDE

Coming from ASP.NET to PHP, a good IDE is very important to me. After doing some research, I decided to start out with NetBeans as the IDE for my PHP development. NetBeans is a free IDE. You can download it from netbeans.org.  Just click the "Download Free" button on the home page and make sure you select the version for PHP development on the next page.  Once you have installed NetBeans on you system, you will have to configure PHP to use NetBeans as the debugger so that you can step through and debug your PHP web applications using NetBeans. 

Here are the steps to setup NetBeans as your debugger:

  1. Open the php.ini file in a text editor. This file is located in C:\xampp\php\ directory.
  2. Search for the line that contains "php_xdebug.dll"
  3. Remove the semicolon from the beginning of this line. Once you're done, it should look like this: zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
  4. Next, search for the line that contains "xdebug.remote_enable = 0"
  5. Remove the semicolon from the beginning of this line and change the 0 to 1. When you're done it should look like this: xdebug.remote_enable = 1
  6. Save your changes.
  7. Start and stop apache.
You have now successfully configured NetBeans as your php debugger.

Display local country time, instent of displaying server time using SafGetLocalTime

<?
//Display local country time, instent of displaying server time,
//If you country is Sri Lanka and web server in in USA, you can use the following script to solve your problem
//$datetime variable shuld contain the date time like date('Y-m-d H:i:s')
//$diferent variable is the diferent between server and your local country like +5.5 -6
//$mylenth from the final out put you can tell to the function how many character from $myafter sould display
//better to keep $myafter=0 and $mylenth=0 as it is

function SafGetLocalTime($datetime,$myafter=0,$mylenth=0,$diferent){ //get local time pass datetime and diferent
list($year,$month,$day,$hour,$minute,$second) = explode("-",str_replace(array(" ",":"),"-",$datetime));
$hour = ($hour+$diferent);
$datetime = mktime($hour,$minute,$second,$month,$day,$year);

if (
$mylenth==0) {
$datetime = date('Y-m-d H:i:s',$datetime);
}else{
$datetime = date('Y-m-d H:i:s',$datetime);
$datetime = substr($datetime,$myafter,$mylenth);
}
return
$datetime;
}
?>

A simple and useful function for escaping user inputs.

After some testing I have developed a function for escaping user inputs. the escaped values can be directly used for inserting to database. It is working fine for me for the last few years..

function safe_escape($string)
{
if(get_magic_quotes_gpc()){
$string = htmlentities($string);
}else{
$string = mysql_real_escape_string($string);
$string = htmlentities($string);
}
return $string;
}

New cart TomatoCart

Here is new type of shopping cart
TomatoCart

On June 28, 2010, TomatoCart celebrated its first anniversary. Since its first release on June 28, 2009, we witness the robust progressing of TomatoCart. From TomatoCart V1.0 alpha 1 to TomatoCart V1.0 stable, it took eleven months. One month closely after, TomatoCart V1.0.1 was released. And the upcoming TomatoCart V 1.1 is soon to unveil.

Thanks to the tireless efforts of the team and the generous support of the community. Owe to your combined efforts, TomatoCart goes so far and achieves today’s progress as an open source project.

Now, TomatoCart comes across a new stage. To be better known in the open source community, it is participating in the Open Source Awards campaign for Most Promising Open Source Project and Open Source E-Commerce Applications Award. Nominate and vote for TomatoCart if you do think it a good open source product. A good result will surely give TomatoCart a new boost.

PHP Operators Index

PHP operators are used to compare two values. It is an expression that takes one or more values and produce another value such that $a+$b where + sign is an operator and a, b are two variable.

PHP operators are two types: 
  • Unary Operator and
  • Binary Operator
Unary Operator: Unary means one. PHP unary operator can take only one value, for an example ++,-- operator. We use ++ operator to increment value and -- operator to decrement value. 
Binary Operator: Binary operator can take two value such that + operator, - operator etc. For an example, $a+$b.

Some PHP operators are plus + operator, minus - operator, * multiply operator, / divide operator and so on. We can divide all PHP operators into different types. Before entering the dept of our PHP tutorial we need to understand each operator clearly. Here is the lists of all PHP operator.
PHP Operators Index:
  • Arithmetic Operators
  • Assignment Operators
  • Comparison Operators
  • Bitwise Operators
  • Incrementing Operators
  • Decrementing Operators
  • Logical Operators
  • Array Operators
  • String Operators
In this PHP tutorial section we will discuss all PHP operators with example. Let's start and learn PHP operators.

Booleans data type in php

This is the easiest type. A boolean expresses a truth value. It can be either TRUE or FALSE.

Syntax

To specify a boolean literal, use either the keyword TRUE or FALSE. Both are case-insensitive.

$foo = True; // assign the value TRUE to $foo

?>

Usually you use some kind of operator which returns a boolean value, and then pass it on to a control structure.

// == is an operator which test

// equality and returns a boolean

if ($action == "show_version") {

echo "The version is 1.23";

}

// this is not necessary...

if ($show_separators == TRUE) {

echo "


\n";

}

// ...because you can simply type

if ($show_separators) {

echo "


\n";

}

?>

Converting to boolean

To explicitly convert a value to boolean, use either the (bool) or the (boolean) cast. However, in most cases you do not need to use the cast, since a value will be automatically converted if an operator, function or control structure requires a boolean argument.

When converting to boolean, the following values are considered FALSE:

the boolean FALSE itself

the integer 0 (zero)

the float 0.0 (zero)

the empty string, and the string "0"

an array with zero elements

an object with zero member variables (PHP 4 only)

the special type NULL (including unset variables)

SimpleXML objects created from empty tags

Every other value is considered TRUE (including any resource).

Warning

-1 is considered TRUE, like any other non-zero (whether negative or positive) number!

var_dump((bool) ""); // bool(false)

var_dump((bool) 1); // bool(true)

var_dump((bool) -2); // bool(true)

var_dump((bool) "foo"); // bool(true)

var_dump((bool) 2.3e5); // bool(true)

var_dump((bool) array(12)); // bool(true)

var_dump((bool) array()); // bool(false)

var_dump((bool) "false"); // bool(true)

?>

get someone else's facebook account password

Simply http://www.hackingemailspasswords.com is the great service I've ever seen to learn hack someones facebook password. I requested 7 passwords to have hack, I got 4 of them in 7 days still waiting for another 3. Service of Learn-To-Hack.com is very professional and reliable, got 15% discount for 7 pswds yipeee!! Thanks Learn-To-Hack.com Thanks for how to hack into yahoo free :)

BTW, I found another website which is providing for free a free facebook hacking software and other one specialized in hack into someone's facebook password, hack facebook account id number.

Jordan N. Wilson,
Lawton, OK
United States

Related articles:
get someone else's facebook account password

First Post

My name is Shiloh. I'm a programmer living in West Palm Beach working for a small magazine developing business and website applications. I primarily program in ColdFusion and C#. My first language was PHP which I still use extensively today. I have found that there are many usefully functions that are built into ColdFusion. PHP has some great built in functions, but they do not meet fully meet the needs of a business application developer. This is my first attempt to build a library of PHP functions that mimic the built in functions in ColdFusion. I have not built any error handling into any of the functions as of yet. They can be touchy if the required variables are not in the required formats.



I would love to get any feedback you have. If you want, send an email to shiloh@cf2php.net!



Cheers and happy programming!

scalar data types in php

boolean , integer , float,string are scalar data types in php

                                                    boolean : it holds boolean values

"true" returns 1 and "false" does not returns any value.
<?php

$a=true;
echo $a;

?>

output : 1

is_bool(x) checks is it bool or not , if bool then return 1  else it is nothing anything



<?php

$a=true;
echo (bool)$a;

?>

output :1


<?php

$a=false;
echo (bool)$a;

?>

output : 1



<?php

$a=5;
echo (bool)$a;

?>

output :

nothing above display , because it is not a boolean value . So, false return . So, onthing to display


                                                           integer : it holds integer values

<?php

$a=5;
echo $a;


?>


output : 5


to convert input value into integer datatype  we use "is_int"


<?php


$a=100;
echo is_int($a);


?>


output : 1


<?php

$a='world';
echo is_int($a);

?>

output :

at above nothing is display
reason : "world" is not an integer
 So, false returned

                                                          float :  it holds floating point value

<?php

$a=10.8;
echo $a;

?>

output : 10.8

                                                     string :  it holds string value

<?php

$a="world";
echo $a;

?>

output : world

<?php

$a="world";
$atr="welcome to $a";
echo $atr;
?>
output  :  welcome to world
<?php


$a="world";
$atr="welcome to $a".'<br>';   // here <br> for new line
$atr='welcome to $a';
echo $atr;
echo 'atr1;



?>


output :
welcome to world
welcome to $a