SharkBait Posted October 7, 2006 Share Posted October 7, 2006 [code]<?phpwhile (!feof($handle)) { # Checks the File pointer integer returned by fopen. $buf = fgets($handle, 1096); # Returns a String from config, 1098 bytes long. list($k,$v)=split('=', $buf); # Create a list of variables and assign string values by splittin$ $v = trim($v); #Remove Whitespace from $V if ( $k ) { $config{$k} = "$v"; } # echo "#" .$k .$v ."<br>"; # echo $config }?>[/code]Well the part I have not seen before is the line [code=php:0] $config{$k} = "$v";[/code] I've never seen curley braces used on a variable. What is it for?The rest of it I do understand.Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/23304-explain-what-this-does/ Share on other sites More sharing options...
redbullmarky Posted October 7, 2006 Share Posted October 7, 2006 the {} when use with a variable means that the variable's name can be dynamic/set on the fly.so:[code]<?php$first = 'dog';$second = 'cat';$animal{$first} = 'woof';$animal{$second} = 'miaw';echo $animaldog;echo $animalcat;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/23304-explain-what-this-does/#findComment-105671 Share on other sites More sharing options...
SharkBait Posted October 7, 2006 Author Share Posted October 7, 2006 Ah thats what I thought. But I've never seen it before until today. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/23304-explain-what-this-does/#findComment-105675 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.