Page 1 of 1

Getting a value from the result of an echo?

Posted: Thu May 14, 2009 3:19 pm
by KeeganWolf
Some help for a beginner in php?
I'm trying to get a file name of an automatically created zip and store that name according to the date as a value to work with it. Heres what I have...

Code: Select all

 
<?php
$store = 4071;
$today = date("md20y");
        echo "Today is ",$today, "<br />";
$tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y"));
        echo "Tomorrow is ".date("md20y", $tomorrow),"<br />"; 
$yesterday = mktime(0, 0, 0, date("m"), date("d")-1, date("y"));
        echo "Yesterday was ".date("md20y", $yesterday),"<br />";
        echo "Your store number is ",$store, "<br />";
        echo "Your store's filename will be S", $store,"".date("md20y", $yesterday), "-", $today, ".zip";
?>
 
It will print the correct filename according to the date as a result
e.g. S407105132009-05142009.zip
But I need to built an unzip function with this script to unzip that file after getting the filename.
How can I make a value $filename from the result of that?

Thanx!

Re: Getting a value from the result of an echo?

Posted: Thu May 14, 2009 3:26 pm
by crazycoders
What is your question? You seem to have a working example, i don't understand what you actually want to do with that information?

PS: When using echo, you can use "," to seperate arguments, but you should normally use "." to concatenate the information together...

Re: Getting a value from the result of an echo?

Posted: Thu May 14, 2009 4:21 pm
by Benjamin
Forum Rules wrote: 11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
You may also want to read:
  1. General Posting Guidelines
  2. Posting Code in the Forums
  3. PHP Manual
  4. PHP Tutorials