FlashKeepers

PHP and Ruby · College · College and University

PHP I: Syntax and Arrays

PHP variables, types, arrays, functions, superglobals, string functions, include and require, and sessions.

About this set

39 basic cards for College PHP and Ruby. Set 1 of 2 in PHP. It opens with "How do you declare a variable in PHP?" and "What are the naming rules for PHP variables?". Study it alongside the other College sets below.

39 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

How do you declare a variable in PHP?
Show answerUse a dollar sign ($) followed by the variable name, for example $name = 'John';
What are the naming rules for PHP variables?
Show answerMust start with a dollar sign and a letter or underscore, followed by alphanumeric characters or underscores. Variable names are case-sensitive.
What is type juggling in PHP?
Show answerAutomatic conversion of a variable from one type to another when an operation requires it.
How do you explicitly cast a variable to a different type in PHP?
Show answerPlace the desired type in parentheses before the variable: (int)$var, (string)$var, (bool)$var, (array)$var.
What is the scope of a variable declared inside a function?
Show answerLocal to that function only, and cannot be accessed outside of it unless declared as global.
What does the PHP string data type store?
Show answerText of any length, enclosed in single or double quotes.
What is the PHP integer data type?
Show answerA whole number with no decimal point, can be positive or negative.
What is the PHP float data type?
Show answerA number with a decimal point or in exponential form, such as 1.5 or 2e3.
What is the PHP boolean data type?
Show answerA data type that holds only true or false, commonly used in conditional statements.
What is the PHP array data type?
Show answerA data structure that stores multiple values in a single variable, each accessed by an index or key.
What does the PHP NULL data type represent?
Show answerAn empty variable, assigned by setting a variable to NULL or when a variable is unset.
What is an indexed array in PHP?
Show answerAn array where elements are accessed by numeric indices starting from 0.
What is an associative array in PHP?
Show answerAn array where elements are accessed by string keys that you define instead of numeric indices.
How do you create a multidimensional array in PHP?
Show answerNest arrays inside other arrays, for example: $array = array(array(1, 2), array(3, 4));
What does the count() function return?
Show answerThe number of elements in an array.

24 more cards in the app

Study this set free