Welcome, Guest. Please login or register.
Did you miss your activation email?
05/21/12, 03:46
Home Help Search Login Register
News: Parsley Flex framework review featuring quiz application, in our Flex frameworks series
Flex SDK 4.5 mobile roadmap: begin with your mobile development
Swiz Flex framework review featuring quiz application
New homepage we release our new Homepage, take a look ...

+  Flash-db
|-+  The Library
| |-+  Technical Reference Area (Moderators: Flash-db, Musicman, BurtonRider1983, vesa kortelainen, Ronald Wernecke, Jorge Solis)
| | |-+  Foundation in PHP for flash
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: Foundation in PHP for flash  (Read 3936 times)
BurtonRider1983
Global Moderator
Systems Administrator
*****
Posts: 864

Rider-4-Life

BurtonRider1983
View Profile WWW
« on: 07/16/02, 22:21 »

Basic PHP Functions

print();

print(string);

Outputs a string.

Can be used interchangably with the echo() function.  This however is not actually a function, so you can use it without the parenthesis(it is a language construct).  

examples:
click on the code to see the output

print('Hello World!');

$variableA = "Hello World!";
print("$variableA");


$variableB = "Ian";
print("My name is $variableB.");


$variableC = "test";
print ($variableC);


$variableD = "test2";
print $variableD;


All of these print functions would work the same without the parenthesis.  Now notice how in the first example there is single quotes rather than double quotes being used. There is no variable to be process, but rather a straight string.  If you used this...

$variableB = "Ian";
print('My name is $variableB.');


Then it would print this "My name is $variableB."

But if you use this code.......

$variableB = "Ian";
print("My name is $variableB.");


It would print "My name is Ian."

The single quotes prints just the string literal and the double quotes tells the php to go through and fill the variables in with there values and then print the string.  It takes longer, but it is so small a period of time that you cannot notice.  This also applies to the echo() function.

I believe that I have covered just about everthing on this function.  If you have any questions, would like me to add something to this function, or are having problems please post them in the general discussion section with the title "library: print()" and I will answer it asap.

echo();
Outputs one or more strings.  Can be used interchangably with the print() function.  This is also not actually a function, so you can use it without the parenthesis(it is a language construct).  

See print(); for examples and syntax.

The difference between print() and echo()

Now they can be used interchangably and many people say that they are the exact same.  In fact, in a book I have (and highly recommend) PHP for Flash, they say that they are the exact same.  Now that is not true.  





to be finished later......I helped out some people and didn't get to finish the part above.  I have to get to work again at 5am and i did this morning, so I got to go.  Check back later.
« Last Edit: 07/18/02, 01:42 by BurtonRider1983 » Logged
BurtonRider1983
Global Moderator
Systems Administrator
*****
Posts: 864

Rider-4-Life

BurtonRider1983
View Profile WWW
« Reply #1 on: 07/18/02, 19:29 »

Basic PHP Functions: time

Intro
Now how many times have you tried to test the time function in actionscript or php and see if it is equal to a string literal like 08:15, January 5, 2005 or an integer 22:06?....it doesn't work huh.  Well that is because the computer does not return the actual time value as we would see it....it returns a unix timestamp.  This is simply the number of seconds that have elapsed since the epoch.  The epoch is simply a date, January 1, 1970 at midnight.  That simple.  Now you are thinking...how the heck do you expect me to calculate such a larger number all of the time?  Well here are some php functions and examples for time....

time();

returns a Unix timestamp.

examples:
click the code to see the output

<?php
print(time());
?>


Not much else to show you about this function without introducing you to more time/date functions in php.

mktime();

Returns a Unix timestamp for a date.  In other words it converts a date that we would normally read into a Unix timestamp which your php scripts could use.

Format:
int mktime ( hours, minutes, seconds, month, day, year [, is_dst])
                             *note: arguments can be excluded from right to left

Everything is pretty self explainable....you could leave out the last argument.  
is_dst -It is for daylight savings.  It defaults to a value of "-1".  You put "0" if it is not daylight savings time and "1" if it is.  If you let it default to the value of "-1" then php tries to figure it out for you.

examples:
click the code to see the output

Lets say that you wanted to change a date of November 14, 1983 (my birth date) to a timestamp....

<?php
print(mktime(0,0,0,11,14,1983));
?>


That is "0" for the hours, "0" for the minutes, "0 for the seconds, "11" for the 11th month of the year November, "14" for the day of the month, and "1983" for the year.  Now check out this code....

<?php
print(mktime(0,0,0,11,14,83));
?>


This just shows you how you can use either a two or four digit integer for the year.  They both output the same thing.




aight too be continued like all of my other stuff.....I know. sorry.  I just got a couple ups packages for over a grand in new computer parts.  I am going to go put a computer together (or at least try, lol).


« Last Edit: 07/18/02, 19:30 by BurtonRider1983 » Logged
Pages: [1] Print 
« previous next »
Jump to:  


Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
anything