Questions tagged [countable]

29 questions
596
votes
40 answers

phpmyadmin - count(): Parameter must be an array or an object that implements Countable

I've uploaded the backup to a table, opening the table I see this: Warning in ./libraries/sql.lib.php#601 count(): Parameter must be an array or an object that implements Countable Backtrace ./libraries/sql.lib.php#2038:…
alebal
  • 5,838
  • 3
  • 10
  • 28
16
votes
2 answers

Overload the behavior of count() when called on certain objects

Possible Duplicate: Count elements for objects implementing ArrayAccess using count()? In PHP 5, you can use magic methods, overload some classes, etc. In C++, you can implement functions that exist as long as the argument types are different. Is…
teynon
  • 7,540
  • 10
  • 63
  • 106
7
votes
1 answer

Prove that the set of all languages over a finite alphabet is uncountable

Trying to do some revision but not sure on this one: Prove that the set of all languages over a finite alphabet is uncountable. I have a feeling it will require using the Cantor Diagonalization method - but I'm not sure how you would use it for…
Robben_Ford_Fan_boy
  • 8,494
  • 11
  • 64
  • 85
4
votes
1 answer

Uncountably many regular languages

Consider the following language S = {0, 00, 000, 0000, 00000,....}. Consider the power-set of S and let each element of the power-set of S be a regular language. Since S is countably infinite its power set is uncountably infinite. Since each element…
4
votes
2 answers

PHP: how can I sort and filter an "array", that is an Object, implementing ArrayAccess?

I have an object that is a collection of objects, behaving like an array. It's a database result object. Something like the following: $users = User::get(); foreach ($users as $user) echo $user->name . "\n"; The $users variable is an object…
duality_
  • 17,738
  • 23
  • 77
  • 95
3
votes
3 answers

relationship between countability and turing machine halting

Hi i have a doubt over countability. Why is it necessary to find out whether certain things are countable. Is there a use over finding it? And also if some thing is uncountable does it mean that there is no Turing machine to solve it ?
user602774
  • 1,093
  • 7
  • 19
  • 31
3
votes
1 answer

Variable is an array but not countable?

I am upgrading our Codeigniter (v. 3.1.11) site from php 5.6 to php 7.2 (currently running on localhost on my Mac). Slowly I am finding all the instances of count() usage and correcting them. It is my understanding that an array is countable, but I…
Jreif
  • 47
  • 7
2
votes
1 answer

cantors zigzag path of zigzag

Could someone please help me out. In the book example, the arrows go in one way and the answer that i came up the arrows goes in a different way. Does the path you have to go through cantors zigzag really matter ?
user602774
  • 1,093
  • 7
  • 19
  • 31
2
votes
1 answer

Prolog program to enumerate all possible solution over a countable set

I am writing a prolog program with can perform Peano arithmetics. I have standard definitions for natural numbers. nat(n). nat(s(N)) :- nat(N). Because I want to enumerate all possible relation of addition between natural numbers, I defined an…
liutaowen
  • 23
  • 2
2
votes
2 answers

PHP 7.4 - Warning: count(): Parameter must be an array

I just upgraded my PHP Version from 5.6 to 7.4. I used count() function in my page, example: $watch_server_count = count($watch_server); if ($watch_server_count > 0) { foreach ($watch_server->table as $key=> $watch_server_rows) { …
user4158643
  • 21
  • 1
  • 5
2
votes
1 answer

Countable subsets in Agda

I need to express the countable property over a specific subset defined by a certain predicate P. My first idea was to explicitly state that there exists a function f which is bijective between my subset and, let's say, the natural numbers. Is there…
MrO
  • 1,291
  • 7
  • 14
1
vote
1 answer

How to define a coding function for all finite subsets of N?

For working with countable sets I have to define a coding function of all finite subsets of N (natural numbers). How can I do this? I started with finding a function for all natural numbers: f(n)=1+2+...+(n-1)+n. But how can I express a coding…
user3351676
  • 91
  • 1
  • 1
  • 5
1
vote
0 answers

Cakephp3 / PHP72 Paginator, Parameter must be an array or an object that implements Countable

After migrating from php5.6 to php7.2 a classical row goes to this error $books = $this->paginate($query, ['limit' => 10]); I read about first use ->toList() before using count() but in this case... Any idea how can i solve this ? I use cakephp…
Konya Istvan
  • 41
  • 1
  • 4
1
vote
1 answer

PHP: Count an ArrayAccess object without Countable

So I'm working with some external PHP code that I don't have the full source for. I am using reflection to work out callable methods, etc. They have a class like so: class SpecialArray implments \ArrayAccess { public function…
cosmorogers
  • 453
  • 2
  • 14
1
vote
1 answer

It is okay to implement \Countable in a PHP class that is not meant to be iterable?

I have a MultipleException class that collects exceptions (e.g. multiple errors in form fields) and implements countable, but I don't want it to be iterable like a list, cause it is actually an exception (you would never throw a list). Is this okay…
itsjavi
  • 2,574
  • 2
  • 21
  • 24
1
2