Hi guys,
Im trying to learn PHP as I go. (The hardest way)
I have usually managed to work everything out as I encountered it but Im having some difficulty with this:
<?php echo $product['product_name'] . $product['product_attributes'] ?>
Can somebody please give me a clue as to what this means when a variable is declared with square brackets after it like this.
Im thinking it has something to do with integration with javascript (Mootools). Somehow, this code snippet produces a URL and Im tearing my hair out to understand how it does so.
All help greatly appreciated.
thanks in advance,
Paula
Code snippet help please
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Code snippet help please
Code: Select all
<?php echo $product['product_name'] . $product['product_attributes'] ?>Code: Select all
<?php
print_r($product);
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: Code snippet help please
You can set an array manually by giving it key values or have the array key values set automatically. Many things loaded from a database are placed in an array.
Check out the link for PHP.NET site explaining about Arrays and the use of them.
http://php.net/manual/en/language.types.array.php
http://www.tizag.com/phpT/arrays.php
http://www.w3schools.com/php/php_arrays.asp
Hope the links help you even further.
Code: Select all
$array[key] = value;http://php.net/manual/en/language.types.array.php
http://www.tizag.com/phpT/arrays.php
http://www.w3schools.com/php/php_arrays.asp
Hope the links help you even further.
Re: Code snippet help please
Thanks guys youre a pair of stars
....
I think Im gonna like this forum!
Paula
I think Im gonna like this forum!
Paula
Re: Code snippet help please
Your very welcome any more help just bob back on forum 