avo Posted July 9, 2006 Share Posted July 9, 2006 Hi All What is the use of [quote]$$[/quote]for example in [code]$amount=$amount + $$s * $a_addtime[$i];[/code]thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/14113-symbol/ Share on other sites More sharing options...
Gast Posted July 9, 2006 Share Posted July 9, 2006 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:[code]<?php$price = "100.00";echo "The price is \$$price";?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14113-symbol/#findComment-55266 Share on other sites More sharing options...
kenrbnsn Posted July 9, 2006 Share Posted July 9, 2006 A variable like that is a variable variable. Please see http://www.php.net/manual/en/language.variables.variable.phpKen Quote Link to comment https://forums.phpfreaks.com/topic/14113-symbol/#findComment-55275 Share on other sites More sharing options...
avo Posted July 9, 2006 Author Share Posted July 9, 2006 HI thanks i was looking for a date function and found this works good but i was just curious on what $$ did[code]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;}[/code]This will add time to time [quote]echo timechange('20:50', '01:40');[/quote]This will minuss time from time [quote]echo timechange('20:50', '01:40', false);[/quote]if anyone would like it Still currious.. ??? Quote Link to comment https://forums.phpfreaks.com/topic/14113-symbol/#findComment-55276 Share on other sites More sharing options...
avo Posted July 9, 2006 Author Share Posted July 9, 2006 Thanks Ken :) Quote Link to comment https://forums.phpfreaks.com/topic/14113-symbol/#findComment-55277 Share on other sites More sharing options...
Gast Posted July 9, 2006 Share Posted July 9, 2006 Wow thanks Ken, I didnt know that. Quote Link to comment https://forums.phpfreaks.com/topic/14113-symbol/#findComment-55278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.