Jump to content


Photo

Symbol


  • Please log in to reply
5 replies to this topic

#1 avo

avo
  • Members
  • PipPipPip
  • Advanced Member
  • 148 posts
  • Locationstaffordshire uk

Posted 09 July 2006 - 08:08 PM

Hi All

What is the use of

$$


for example in

$amount=$amount + $$s * $a_addtime[$i];

thanks in advance
Im loving it ........

#2 Gast

Gast
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 09 July 2006 - 08:09 PM

I have never seen a double $ used like that. The only time I can think of two $ being used next to each other is if you echoing a US price next to a variable:

<?php
$price = "100.00";
echo "The price is \$$price";
?>

OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Tutorials:
Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 09 July 2006 - 08:18 PM

A variable like that is a variable variable. Please see http://www.php.net/m...es.variable.php

Ken

#4 avo

avo
  • Members
  • PipPipPip
  • Advanced Member
  • 148 posts
  • Locationstaffordshire uk

Posted 09 July 2006 - 08:19 PM

HI thanks i was looking for a date function and found this

works good but i was just curious on what $$ did

function timechange($starttime, $addtime, $add = true) {
        $min = 60;
        $hour = $min * 60;

        $a_time = array('hour', 'min', 'sec');
        $a_addtime = explode(':', $addtime);
        $amount = 0;
        for ($i = 0; $i < count($a_addtime); $i++) {
                $s = $a_time[$i];
                $amount += $$s * $a_addtime[$i];
        }

        $starttime = strtotime($starttime);
        $s = ($add === true) ? date('H:i', $starttime + $amount) : date('H:i', $starttime - $amount);
        return $s;
}

This will add time to time

echo timechange('20:50', '01:40');


This will minuss time from time

echo timechange('20:50', '01:40', false);


if anyone would like it

Still currious.. ???
Im loving it ........

#5 avo

avo
  • Members
  • PipPipPip
  • Advanced Member
  • 148 posts
  • Locationstaffordshire uk

Posted 09 July 2006 - 08:20 PM

Thanks Ken  :)
Im loving it ........

#6 Gast

Gast
  • Members
  • PipPipPip
  • Advanced Member
  • 131 posts
  • LocationSouth East England

Posted 09 July 2006 - 08:21 PM

Wow thanks Ken, I didnt know that.
OS and Internet Specs:
Windows XP (with SP2), 1680x1050, PHP 4, MySQL 3, Internet Explorer 6 &7 /FireFox 2.0/Opera 9.2

Tutorials:
Simple Introduction to AJAX and XMLHttpRequest
Creating Live Data with AJAX Making a Google Suggest like application




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users