| | |
Please help me with this very basic variables question...
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2009
Posts: 29
Reputation:
Solved Threads: 0
Hi folks,
I am brand new to PHP, but I am trying to learn from an online tutorial. I'm using this one:
http://inpics.net/tutorials/php/variables24.html
I'm sure there are many others, but that's where I'm at now. I am on the variables section, and they present this code:
The problem is when I run this, I get this error:
Parse error: syntax error, unexpected '=' in /home/content/m/b/i/mbirame/html/PHPscripts/numberlist.php on line 7
I have PHP5 running on my server...have things changed in 5 to make me need different code for the variables?
Thank you!
Joel
I am brand new to PHP, but I am trying to learn from an online tutorial. I'm using this one:
http://inpics.net/tutorials/php/variables24.html
I'm sure there are many others, but that's where I'm at now. I am on the variables section, and they present this code:
PHP Syntax (Toggle Plain Text)
<?php # This script demonstrates how to # create a numeric array. @AcmeInventory = (178,286,387); print "$AcmeInventory[0]<br>\n"; print "$AcmeInventory[1]<br>\n"; print "$AcmeInventory[2]<br>\n"; print "<p>We just created a list of numbers using an array variable!"; ?>
The problem is when I run this, I get this error:
Parse error: syntax error, unexpected '=' in /home/content/m/b/i/mbirame/html/PHPscripts/numberlist.php on line 7
I have PHP5 running on my server...have things changed in 5 to make me need different code for the variables?
Thank you!
Joel
It seems there is an error in the tutorial you are using. the "@" symbol is actually used to suppress an error that the following function might throw: http://www.tuxradar.com/practicalphp/19/8/12
I'm assuming the author ment that to be a "$" symbol, as that indicates a variable. that line should be
EDIT: If that doesn't work, change that line to this:
I'm assuming the author ment that to be a "$" symbol, as that indicates a variable. that line should be
$AcmeInventory = (178,286,387); .EDIT: If that doesn't work, change that line to this:
$AcmeInventory = array(178,286,387); . Last edited by humbug; Jul 22nd, 2009 at 11:13 pm. Reason: added note
★ "If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
I'm assuming it's just a bad tut because of the lack of attention to detail and testing. The @ symbol was never for variables.
★ "If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
★ Did I help you out? Did I piss you off? Add to my reputation!
★ The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
![]() |
Similar Threads
- Issue Sharing variables across two forms: VB Express 2008 (VB.NET)
- variables question (Assembly)
- VBscript in a Visual Basic Application (Visual Basic 4 / 5 / 6)
- Basic SQL question! (MS SQL)
- Basic Access Question (MS Access and FileMaker Pro)
- Basic Variables Question (Visual Basic 4 / 5 / 6)
- Basic scripting question (Getting Started and Choosing a Distro)
Other Threads in the PHP Forum
- Previous Thread: error with base64_decode returning the data instead of the images
- Next Thread: PHP sessions
| Thread Tools | Search this Thread |
ajax apache api array beginner binary body broken buttons cakephp checkbox class cms code cron curl database date date/time display dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm msqli_multi_query multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql static subdomain syntax system table tag tutorial update upload url validator variable vbulletin video web websphere white wordpress xml youtube





