Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 26th, 2012, 02:58 AM
Registered User
 
Join Date: Nov 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up variables in php

here is the simple example for declaring variables:

<?php
$txt="Hello World!";
$x=16;
?>

Thank u,

Regards
Srikanth
rxonlineshopee.com
 
Old April 30th, 2013, 04:59 AM
Registered User
 
Join Date: Dec 2012
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Smile

some of Note for declare a variable
variables in PHP start with a dollar sign ($)
variables' names are case sensitive
you can use alphanumeric characters and underscores (no spaces)
the first character of a string name can be a letter or an underscore (no numbers)
you can assign a value to a variable using the assignment operator (=)
you cannot name a variable $this
if the value is a piece of text (a string) you have to wrap the value in between quotation marks
if the name of the variable contains more than one word, please use lower camel case notation (e.g. $thisIsMyName or $varNameHere)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace - how to declare? JillB Excel VBA 0 January 25th, 2008 07:11 PM
declare My ajkumar Visual Basic 2005 Basics 0 April 18th, 2007 05:24 AM
HOW DECLARE VARIABLES IN PHP jhan316 Beginning PHP 1 July 25th, 2006 07:16 PM
Can I declare variables visable from every script Makis Beginning PHP 1 January 11th, 2004 02:02 AM
how to declare date variables rehana Beginning PHP 1 December 15th, 2003 05:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.