I am just getting my feet wet so please forgive this newbie question.
Does php have a command that does the same as @checkforthis that I use with my cgi programs to check for certain conditions.
Thanks,
Over40
Newbie Question - Please help
Moderator: General Moderators
-
microthick
- Forum Regular
- Posts: 543
- Joined: Wed Sep 24, 2003 2:15 pm
- Location: Vancouver, BC
yes, and if used in a scalar context it returns the number of elements.
$ indicates a scalar (a flat value), sooutputs 8
php doesn't handle the variable contenxt in this way.
$ indicates a scalar (a flat value), so
Code: Select all
my @arr = qw(a b c d e f g h);
$numElems = @arr;
print $numElems, "\n";php doesn't handle the variable contenxt in this way.
Code: Select all
<?php
$arr = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h');
echo count($arr);
?>