Invalid Argument

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Something seems to be wrong with this function and I can't figure out
why it is failing. The error that it gives is; Invalid argument
supplied for foreach() .

function transposition($words){
  foreach($words as $word){
      $results[] = substr($word, 0, $x) . $word[$x+1] . $word[$x] .
substr($word, $x+2, strlen($word));
  return $results;

The way I call the function is:


Do you see anything wrong?


Re: Invalid Argument

BryanA wrote:
Quoted text here. Click to load it

That's because $words is not an array.

And your echo statement is calling the function 'correct', not the
function 'transposition'.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline