Jump to content

Displaying number of answered questions in an array.


Recommended Posts

Hi folks.


I have something I want to do but don't have the knowledge to do it. I know the bare bones of php but not enough to to right home about. Here's what I would like to do. I am using wordpressand a theme that uses this line of code to get all users information in an array.


$questions = ThemexUser::$data['user']['profile'];


What I would like to do is get the number of filled in fields and display them. EG: "You have 7 of 11 fields filled out". I have been trying for a week now without any results. Any help would be greatly appreciated.

Link to comment
Share on other sites

Ok, here's what I have so far.

$a = 0;
$v = count($a);
$questions = in_array("$a", ThemexUser::$data['user']['profile'], true);
echo $v;

So now you can better see what I'm trying to do. This code gives me a "0", however I purposly left 3 questions unanswered so I'm doing something wrong.


FYI: The result from "var_export($questions)" is false.

Link to comment
Share on other sites

This thread is more than a year old. Are you sure you have something important to add to it?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.