I am trying debug a custom rule I am creating. In my helper function I am calling an array I want to work with. I want to dpm the contents of the array so that I can see what is available, but it is not working. To check that there wasn't a problem with my array. I set up a new one inside the helper function.

$array = [
      "foo" => "bar",
      "bar" => "foo",

and then try to dpm the array:

dpm ("array: " . $array);

but all that is shown in the status message is:

array: Array

I have been trying other methods of printing the array like print_r but haven't had any success with these either. How should I be printing my array?


You can only have a string (not an array) as the second argument to dpm().


dpm($array, "array: ");
| improve this answer | |
  • Thanks. I had been banging my head against the wall over that! – Paul Trotter Apr 11 '16 at 13:02
  • I would advise using xdebug to debug this sort of thing - it will really save you the headache of trying to debug custom rules. – Kevin Apr 11 '16 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.