Archive for July, 2008...
Filed under Programming, PHP
When you start creating advanced applications that require different types of data that may be defined by a developer using your system you come across a very interesting issue.
Dynamic Variables...
They are quite easy to master, just look at the below example.
CODE:
-
$foo = 'howdy';
-
$$foo = 'not howdy';
-
-
echo $$foo; //should return not howdy
Learn more by going here:
http://www.php.net/manual/en/language.variables.variable.php
Filed under Make you smile
Enjoy!
http://www.youtube.com/watch?v=g0dIpYw75jA&feature=user
Filed under Programming, PHP
http://www.phpdoc.org/
Easy, Fast, and Efficient.
Just make sure your code is developed within a standard and you comment very well.
Filed under Programming, Javascript
In some situations we are required to take a value that was intended to be a string and convert it to a numerical value for calculations.
In this situation we would implement a form of variable control called "Casting".
CODE:
-
//String
-
var string = "5.00";
-
-
//What would happen if we wanted to add another 5.00 to string?
-
//Well, it would append the 5.00 to the original 5.00 - Example: 5.005.00
-
//We need to Cast "string" so that we can do numerical calculations.
-
var numeric = parseFloat(string)+5.00;
-
//You can use
-
//parseFloat - number with a decimal point.
-
//parseInt - whole number.
Simple and effective.
Filed under Programming, PHP
How do you show errors for a single php script when the entire server has the enviorment variable "display_errors" set to 0?
Simple - place the below code at the top of your script.
CODE:
-
ini_set("display_errors", 1);
-
error_reporting(E_ALL);
ini_set - allows you to mess with your php.ini file.
error_reporting - sets what kind of errors you wish to show.