Getting a value from the result of an echo?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KeeganWolf
Forum Newbie
Posts: 19
Joined: Thu May 14, 2009 3:13 pm

Getting a value from the result of an echo?

Post 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!
Last edited by KeeganWolf on Fri May 15, 2009 9:59 am, edited 1 time in total.
crazycoders
Forum Contributor
Posts: 260
Joined: Tue Oct 28, 2008 7:48 am
Location: Montreal, Qc, Canada

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

Post 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...
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

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

Post 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
Post Reply