Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hey guys I have a few questions. Each question can have one answer or multiple a

ID: 3675253 • Letter: H

Question

Hey guys I have a few questions. Each question can have one answer or multiple answers. CODE: PHP

Which is the correct syntax for declaring a variable and assigning it a string?
$MyVariable = “Hello”;
$MyVariable = “Hello”
“Hello” = $MyVariable;
$MyVariable = Hello;

Which of the following refers to the first element in an indexed named $Employees[]?
$Employees[1]
$Employees[first]
$Employees[a]
$Employees[0]

Which of the following functions returns the length of a string?
strspn()
strlen()
strcspn()
substr_count()

Casting or type casting creates an equivalent value in a specific data type for a given value.
True
False

Which of the following functions allows you to replace character within a specified portion of a string?
str_ireplace()
str_replace()
substr_replace()
substr ()


Which of the following functions splits each character in a string into an array element?
str_split()
split()
explode
implode

Which of the following operators can you use to append one array to another? (Choose all that apply)
.
+
+=
=>

Which of the following functions removes the first element from the beginning of an array?
array_shift()
array_unshift()
array_push()
array_pop()

Which of the following functions removes duplicate elements from an array?
array_duplicates()
array_unique()
remove_duplicates()
unique()


Variables in PHP start with which symbol?
<
?
$
*

Explanation / Answer

1)Which is the correct syntax for declaring a variable and assigning it a string?
$MyVariable = “Hello”;

2) Which of the following refers to the first element in an indexed named $Employees[]?

$Employees[0]

3) Which of the following functions returns the length of a string?

strlen()

4) Casting or type casting creates an equivalent value in a specific data type for a given value.

True

5) Which of the following functions allows you to replace character within a specified portion of a string?

substr_replace()

6) Which of the following functions splits each character in a string into an array element?

str_split()

7) Which of the following operators can you use to append one array to another?

=>

8) Which of the following functions removes the first element from the beginning of an array?

array_shift()

9) Which of the following functions removes duplicate elements from an array?

array_unique()

10) Variables in PHP start with which symbol?

$