Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4265722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:39:46+00:00 2026-05-21T06:39:46+00:00

I am using Cakephp and try to customize the paginator result with some checkboxes

  • 0

I am using Cakephp and try to customize the paginator result with some checkboxes .I was pass parameters in URL like this

"http://localhost/myproject2/browses/index/page:2/b.sonic:1/b.hayate:7/b.nouvo:2/b.others:-1/b.all:-2"

and cakephp translate URL to be the array like this

Array
(
    [page] => 2
    [b.sonic] => 1
    [b.hayate] => 7
    [b.nouvo] => 2
    [b.others] => -1
    [b.all] => -2
)

other time when I pass params without checking any checkbox.

“http://localhost/myproject2/browses/index/page:2”

and cakephp translate URL to be the array like this

Array
(
    [page] => 2

)

how to simple check if [b.????] is available or not? I can’t use !empty() function because array[page] is getting on the way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:39:47+00:00Added an answer on May 21, 2026 at 6:39 am

    If you want to check if a specific item is present, you can use either :

    • isset()
    • or array_key_exists()

    But if you want to check if there is at least one item which has a key that starts with b. you will not have much choice : you’ll have to loop over the array, testing each key.

    A possible solution could look like this :

    $array = array(
        'page' => 'plop',
        'b.test' => 150, 
        'b.glop' => 'huhu', 
    );
    
    $found_item_b = false;
    foreach (array_keys($array) as $key) {
        if (strpos($key, 'b.') === 0) {
            $found_item_b = true;
            break;
        }
    }
    
    if ($found_item_b) {
        echo "there is at least one b.";
    }
    

    Another (possibly more fun, but not necessarily more efficient ^^ ) way would be to get the array of items which have a key that starts with b. and use count() on that array :

    $array_b = array_filter(array_keys($array), function ($key) {
        if (strpos($key, 'b.') === 0) {
            return true;
        }
        return false;
    });
    
    echo count($array_b);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using CakePHP 1.3 there are named parameters in the URL like .../name:value/... These are
I'm getting this error when I try to mail from CakePHP 2.0 using CakeEmail:
i am trying to create a Radio button using Cakephp like the one the
I am getting this error when I try to run a CakePHP 2.1 Shell
Using CakePHP 1.3 I'm trying to save some data to a MySQL database. The
I am using cakephp with postgresql. Some of my tables are very large.When using
Hey there, I'm using the tutorial at http://www.jamesfairhurst.co.uk/posts/view/uploading_files_and_images_with_cakephp to try to get myself up
Using CakePHP's Ajax based observefield, I would like to update multiple fields, into my
I try to create a CakePHP application based on themes. I using the latest
Using CakePHP 1.3 , I post a form which correctly fills in $this->data .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.