Without seeing the context into which that program fragment fits it is impossible to say. These sort of challenges often depend on setting up obscure flaws that very rarely occur in general programming

Given the fact that the error code you mentioned explicitly mentions an array problem I cannot see how the earlier lines would cause a difficulty. Still I assume that we are now talking about these lines

"Read through the second and third lines slowly and carefully. Look at
each variable that is being set and each variable that is being read.
(Variables to the left of the = are being set.) Ask yourself what it's
supposed to be carrying, and see if you can spot what it really is
instead.

Here's a hint: In line two, I assigned a value to a variable, but on
line 3, I forgot to use it and used something else instead. "

I'm confused by your last post. Are you telling me that you solved it? You specifically asked about the array_shift and $data and I gave you some tips on that so I do not see what you are getting at. There is a POTENTIAL error on line 2 where it says

if ($master = MyActiveRecord::FindById('widgets',$original) )

and it might have been intended to say

if ($master == MyActiveRecord::FindById('widgets',$original) )

however it should be noted that doing assignments in IF statements is quite common, for instance a statement like

if ( $fp = fopen("filename","r") .....

is a very common occurrence and is not incorrect so the statement in line 2 might be correct.

No that didn't solved the problem, try read my last post if you follow it you'll find an error. I can't find it.

"Read through the second and third lines slowly and carefully. Look at
each variable that is being set and each variable that is being read.
(Variables to the left of the = are being set.) Ask yourself what it's
supposed to be carrying, and see if you can spot what it really is
instead.

Here's a hint: In line two, I assigned a value to a variable, but on
line 3, I forgot to use it and used something else instead. "

Syntactically there is nothing wrong. The only question is whether the IF on line 2 should be an assignment (unlikely, but possible) or a comparison (more likely). Without knowing the context that the code fragment is used in it is not possible to deduce the values and types of the variables used.

Has the error message changed? Is it still complaining about $data? If so then $data is not an array and it has to be for array_shift to work.

What are these rather cryptic paragraphs you keep posting? Are they from someone else looking at this?

Without seeing the context into which that program fragment fits it is impossible to say. These sort of challenges often depend on setting up obscure flaws that very rarely occur in general programming work.

From reading the comment above I would *guess* that he wants you to use a different variable than $original and since the only variable on line 2 that is assigned a value is $master it may be that variable that he is hinting at, but without knowing what the class method returns you can only guess.

Featured Post

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP. PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…

Nothing in an HTTP request can be trusted, including HTTP headers and form data. A form token is a tool that can be used to guard against request forgeries (CSRF). This article shows an improved approach to form tokens, making it more difficult to…