On 1/28/2011 11:23 AM, David Harkness wrote:
> On Fri, Jan 28, 2011 at 11:03 AM, Marc Guay wrote:
>
>> If COUNTing is the heavy part, why not create a 'users_logged_in'
>> field somewhere and increment it when someone logs in and decrement it
>> when someone logs out? Then your query is just a s
On Fri, Jan 28, 2011 at 11:03 AM, Marc Guay wrote:
> If COUNTing is the heavy part, why not create a 'users_logged_in'
> field somewhere and increment it when someone logs in and decrement it
> when someone logs out? Then your query is just a straight SELECT.
If this is like most web sites, us
> I'm looking for a faster way to count online users. COUNT(*) is time
> consuming under MySQL.
If COUNTing is the heavy part, why not create a 'users_logged_in'
field somewhere and increment it when someone logs in and decrement it
when someone logs out? Then your query is just a straight SELEC
If you're using memcached already you could store the number in it and
update it only when a user logs in/out. If no one is logging in/out, the
number isn't changing.
If your site is so popular that hundreds of users are logging in every
second you might want to change the logic so that the proces
Jim, I'm already using the solution you mentioned.
The problem is about the performance.
One solution is to increase the performance by using Memcached.
But counting online users always requires a __new__fresh__ COUNT(*) query, even
under Memcahched. Since the COUNT(*) result is very dynamic and
On 1/28/2011 9:57 AM, AmirBehzad Eslami wrote:
> Dear list,
>
> The common solution for counting online users is to store sessions in a Table.
> I've created a Table in MySQL to acheive the result, but it seems this
> solution
> is a little heavy for such a simple task.
>
> Is there a better alt
How did you created the table? Can you count the Id's only? Wouldn't
this just count the entries in the index?
On 28/01/2011 12:57, AmirBehzad Eslami wrote:
Dear list,
The common solution for counting online users is to store sessions in a Table.
I've created a Table in MySQL to acheive the
Hi
I have an XML generated by another computer application. The format is
as below. (Don't worry about the data in the XML. Its the test
data).
I am able to locate the correct member bill using XPATH.
However I have hit a bottleneck. I am unable to echo all the
elements. This is what happens
If it's a simple x < y, you might want to consider putting your if
statement in the SQL query so you don't return so many rows. To make a
counter, just set a variable like:
$counter = 0;
if ($x <$y)
{
print $row;
$counter++
}
Thank you,
Micah Gersten
onShore Networks
Internal Developer
h
I have been working on the something for the last day and can't figure it
out.
I am pulling 7500 rows from a MySQL database, but I only want to display a
certain numbers of rows based up an if statement. I want to count the rows
within the if statement.
mysql query result
if(x < y){
d
// glob returns an ordered list (rtfm: man glob)
// relies on the use of the operator ++ to generate string sequences.
function lastFileInSequence($path, $prefix, $first, $suffix) {
return array_pop(glob($path . "/" . $prefix . str_repeat('?',
strlen($first)) . $suffix));
}
function nextFileI
At 11:47 PM -0400 9/29/07, brian wrote:
You and i have had our run-ins on this list on more than one
occasion. Until now, i've chosen to take your crap in stride.
brian
I haven't noticed any "run-ins". I don't care if you've been the
biggest prick on the net -- if you ask a question and it's
gee you guys behave like kids. don't you all have other things to do than
whinge, swear and blame each other on the list? Take it elsewhere and sort
it out. This is bad for the PHP community in general. It doesn't reflect what
the community is about.
my 2c.
On Sunday 30 September 2007 13:47,
On Sat, 2007-09-29 at 23:47 -0400, brian wrote:
>
> It's not so much that i disrespect Rob. It's just that i felt i had to
> call him out for being a dickhead by taking my statement out of context.
Ok, so I'm a dickhead. What does that make you? A vagina?
Name calling really is the lowest form o
tedd wrote:
At 8:30 PM -0400 9/27/07, brian wrote:
I wasn't bitching! And i *thought* that my numerous attempts at
explaining such would have been enough. Obviously not, but wtf can you
do with people who seem to want only to stir up shit?
It sure sounded like you were bitching.
Gee, thanks
; From: tedd [mailto:[EMAIL PROTECTED]
> Sent: 28 September 2007 17:20
> To: brian; php-general@lists.php.net
> Subject: Re: [PHP] counting with leading zeros
>
> At 8:30 PM -0400 9/27/07, brian wrote:
> >I wasn't bitching! And i *thought* that my numerous attempts at
&g
At 8:30 PM -0400 9/27/07, brian wrote:
I wasn't bitching! And i *thought* that my numerous attempts at
explaining such would have been enough. Obviously not, but wtf can you
do with people who seem to want only to stir up shit?
It sure sounded like you were bitching.
And, your off-list "fuck y
tedd wrote:
At 3:58 PM -0400 9/26/07, brian wrote:
Well, this is almost precisely the same thing i have, save for
using POSIX character classes, str_pad instead of sprintf(), and
incrementing elsewhere. What i was really wondering is if there was
a *much simpler* way to do this, not just re-
At 10:39 PM -0400 9/26/07, brian wrote:
Now you're obviously just trying to be a dickhead.
While someone is, it's not Rob.
Cheers,
tedd
--
---
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: h
Robert Cummings wrote:
Suit yourself. But better programmer's don't just wave their hands in
the air and hope for the best.
Ah crap -- there's another technique I have to cross off my list.
Cheers,
tedd
--
---
http://sperling.com http://ancientstones.com http://earthstones.com
--
PH
At 3:58 PM -0400 9/26/07, brian wrote:
Well, this is almost precisely the same thing i have, save for using
POSIX character classes, str_pad instead of sprintf(), and
incrementing elsewhere. What i was really wondering is if there was
a *much simpler* way to do this, not just re-arranging thing
On Wed, 2007-09-26 at 21:56 -0700, Jim Lucas wrote:
>
> Now, if you plan to delete any images in the list, this will not work.
>
> But if you don't expect to delete any images in the list and always want
> the ($total_images + 1), then follow along.
>
>
> function getNextImage($path, $prefix)
brian wrote:
I have a directory that contains many images (no, not pr0n,
unfortunately) and i'm working on an admin script for adding to it. I've
got something that works alright but i'm wondering if there's a Better Way.
Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on.
On Thu, 2007-09-27 at 00:23 -0400, brian wrote:
> Robert Cummings wrote:
> > When you use sort() the default behaviour is a lexical sort. This is why
> > the 100th index breaks your system. I'm not trying to be a dickhead,
> > just pointing out the flaw in your logic. You may be well aware that in
Robert Cummings wrote:
When you use sort() the default behaviour is a lexical sort. This is why
the 100th index breaks your system. I'm not trying to be a dickhead,
just pointing out the flaw in your logic. You may be well aware that in
counting 100 comes after 99, but it would seem you are not w
On Wed, 2007-09-26 at 22:39 -0400, brian wrote:
> Robert Cummings wrote:
> > On Wed, 2007-09-26 at 19:10 -0400, brian wrote:
> >
> >>If my response to that gave you the impression i was
> >>complaining, i assure you that i wasn't. I was simply suggesting
> >>that i was wondering if there was a *mu
Robert Cummings wrote:
On Wed, 2007-09-26 at 19:10 -0400, brian wrote:
If my response to that gave you the impression i was
complaining, i assure you that i wasn't. I was simply suggesting
that i was wondering if there was a *much* simpler way to do this, ie.
without using several functions to
On Wed, 2007-09-26 at 19:10 -0400, brian wrote:
> Robert Cummings wrote:
>
> >> Well, this is almost precisely the same thing i have, save for
> >> using POSIX character classes, str_pad instead of sprintf(), and
> >> incrementing elsewhere. What i was really wondering is if there was
> >> a *mu
Robert Cummings wrote:
On Wed, 2007-09-26 at 15:58 -0400, brian wrote:
Robert Cummings wrote:
On Wed, 2007-09-26 at 15:11 -0400, brian wrote:
I have a directory that contains many images (no, not pr0n,
unfortunately) and i'm working on an admin script for adding to
it. I've got something
On Wed, 2007-09-26 at 15:58 -0400, brian wrote:
> Robert Cummings wrote:
> > On Wed, 2007-09-26 at 15:11 -0400, brian wrote:
> >
> >>I have a directory that contains many images (no, not pr0n,
> >>unfortunately) and i'm working on an admin script for adding to it. I've
> >>got something that wor
Robert Cummings wrote:
On Wed, 2007-09-26 at 15:11 -0400, brian wrote:
I have a directory that contains many images (no, not pr0n,
unfortunately) and i'm working on an admin script for adding to it. I've
got something that works alright but i'm wondering if there's a Better Way.
Each image i
On Wed, 2007-09-26 at 15:11 -0400, brian wrote:
> I have a directory that contains many images (no, not pr0n,
> unfortunately) and i'm working on an admin script for adding to it. I've
> got something that works alright but i'm wondering if there's a Better Way.
>
> Each image is named like: foo
I have a directory that contains many images (no, not pr0n,
unfortunately) and i'm working on an admin script for adding to it. I've
got something that works alright but i'm wondering if there's a Better Way.
Each image is named like: foo_01.jpg, foo_02.jpg, bar_01.jpg, and so on.
When adding
At 12:32 AM +0100 6/21/07, Richard Davey wrote:
Hi,
I've written a short regexp which will *count* how many capital letters
are in a given string (the woefully simple: '/[A-Z]/')
Although it's an English language web site, I'm curious how you'd
count capital letters that span beyond just the st
On 21/06/07, Richard Davey <[EMAIL PROTECTED]> wrote:
Hi,
I've written a short regexp which will *count* how many capital letters
are in a given string (the woefully simple: '/[A-Z]/')
Although it's an English language web site, I'm curious how you'd
count capital letters that span beyond just
Hi,
I've written a short regexp which will *count* how many capital letters
are in a given string (the woefully simple: '/[A-Z]/')
Although it's an English language web site, I'm curious how you'd
count capital letters that span beyond just the standard A-Z.
For example characters such as the La
On 6/15/07, Toni Torello <[EMAIL PROTECTED]> wrote:
hi guys,
just supposing...
which is the right way to to count the number of code lines in a php
application?
do you think that the raw:
$ find . -name '*.php' -exec cat {} \; | wc -l
can be a good estimate?
I recently desired to know a simil
hi guys,
just supposing...
which is the right way to to count the number of code lines in a php
application?
do you think that the raw:
$ find . -name '*.php' -exec cat {} \; | wc -l
can be a good estimate?
just a curiosity: according to this criteria...
phpmyadmin ~ 12 code lines
drupal ~ 6
On Sat, February 17, 2007 1:53 pm, clive wrote:
> Denis L. Menezes wrote:
>> Dear friends.
>>
>> I have a site where I have news headers. I wish to count the clicks
>> on the
>> news headers so that I can see how many times each of the the news
>> has been
>> viewed. This way I can show the "most v
Brad Bonkoski wrote:
> I think the best way to do this would be to set an onClick (Javascript)
> event handler for each of the links, and then use AJAX style stuff to
> send the information to PHP on the server side, then PHP can log the
> link that was clicked, and keep track of the most clicked l
Denis L. Menezes wrote:
Dear friends.
I have a site where I have news headers. I wish to count the clicks on the
news headers so that I can see how many times each of the the news has been
viewed. This way I can show the "most viewed" news.
Can one of you please advise hwo this can be done?
Hello Brad,
Saturday, February 17, 2007, 4:22:22 PM, you wrote:
> Denis L. Menezes wrote:
>> Dear friends.
>>
>> I have a site where I have news headers. I wish to count the clicks on the
>> news headers so that I can see how many times each of the the news has been
>> viewed. This way I can show
Denis L. Menezes wrote:
Dear friends.
I have a site where I have news headers. I wish to count the clicks on the
news headers so that I can see how many times each of the the news has been
viewed. This way I can show the "most viewed" news.
Can one of you please advise hwo this can be done?
Dear friends.
I have a site where I have news headers. I wish to count the clicks on the
news headers so that I can see how many times each of the the news has been
viewed. This way I can show the "most viewed" news.
Can one of you please advise hwo this can be done?
Thanks
Denis
--
PHP Gen
Thanks for the link to the function. Know that I did RTFM before
posting, but I missed that one.
Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/219/xyz.php
http://simplesniff.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
At 8:35 PM +0200 12/24/06, Dotan Cohen wrote:
Has this wheel been invented, but simpler? I've an array of words that
I'd like to know how many occurences of each there are. For instance:
$fruits = array(
"lemon",
"orange",
"banana",
"apple",
"orange",
"banana",
"orange");
Dotan Cohen wrote:
Has this wheel been invented, but simpler? I've an array of words that
I'd like to know how many occurences of each there are. For instance:
$fruits = array(
"lemon",
"orange",
"banana",
"apple",
"orange",
"banana",
"orange");
And I'd like to create th
Has this wheel been invented, but simpler? I've an array of words that
I'd like to know how many occurences of each there are. For instance:
$fruits = array(
"lemon",
"orange",
"banana",
"apple",
"orange",
"banana",
"orange");
And I'd like to create this:
$fruit_count = a
Ross wrote:
Anyone got a script so I can count clicks on adverts. Doesn't have tosve to
myqsl or anything just a text file will do.
What about using mysql, but use a memory resident heap table, then every
once in a while write this to a file or even better to a myisam table
Ta
Ross
-
[snip]
This has a race condition where a busy server, or even a not-so-busy
one where 2 people happen to click at the same time, at least one of
them will be "missed", at best.
There's also a distinct possiblity of the counter file getting
completely trashed, depending on the OS and its underlying
On Wed, November 29, 2006 11:21 am, Jay Blanchard wrote:
> [snip]
> Anyone got a script so I can count clicks on adverts. Doesn't have
> tosve
> to
> myqsl or anything just a text file will do.
> [/snip]
>
>
> if("yes" == $adClicked){
>$adClickCountFile = fopen("countClick.txt", "w");
>$ge
[snip]
Anyone got a script so I can count clicks on adverts. Doesn't have tosve
to
myqsl or anything just a text file will do.
[/snip]
YMMV
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Anyone got a script so I can count clicks on adverts. Doesn't have tosve to
myqsl or anything just a text file will do.
Ta
Ross
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, 2006-10-31 at 11:58 +0100, Robin Vickery wrote:
> On 30/10/06, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote:
> > > On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
> > > > On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wr
On Tue, October 31, 2006 4:58 am, Robin Vickery wrote:
> On 30/10/06, Robert Cummings <[EMAIL PROTECTED]> wrote:
>> On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote:
>> > On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
>> > > On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
On 30/10/06, Robert Cummings <[EMAIL PROTECTED]> wrote:
On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote:
> On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
> > On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
> >
> > > On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
# [EMAIL PROTECTED] / 2006-10-27 20:14:58 +0200:
> > And the header("Location: ...") requires a full URL.
> Why?
HTTP protocol specification[1] says:
14.30 Location
The Location response-header field is used to redirect the recipient
to a location other than the Request-URI for completion
On Mon, 30 Oct 2006 12:28:29 +0100, Robin Vickery wrote:
> On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
>> On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
>> > On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
>> >> On Friday 27 October 2006 19:34, Richard Lynch wrote:
>>
On Mon, 2006-10-30 at 12:28 +0100, Robin Vickery wrote:
> On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
> > On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
> >
> > > On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
> > >> On Friday 27 October 2006 19:34, Richard Lynch wrot
On 30/10/06, Ivo F.A.C. Fokkema <[EMAIL PROTECTED]> wrote:
On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
> On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
>> On Friday 27 October 2006 19:34, Richard Lynch wrote:
>>> And the header("Location: ...") requires a full URL.
>>
>> No it
On Sun, 29 Oct 2006 23:40:47 -0600, Richard Lynch wrote:
> On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
>> On Friday 27 October 2006 19:34, Richard Lynch wrote:
>>> And the header("Location: ...") requires a full URL.
>>
>> No it doesn't. but he's missing an ' at first glance
>
> Yes, it
On Fri, October 27, 2006 4:53 pm, Børge Holen wrote:
> On Friday 27 October 2006 19:34, Richard Lynch wrote:
>> And the header("Location: ...") requires a full URL.
>
> No it doesn't. but he's missing an ' at first glance
Yes, it does:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3
On Fri, October 27, 2006 12:14 pm, [EMAIL PROTECTED] wrote:
>> And the header("Location: ...") requires a full URL.
> Why?
Because the docs say so?
Because some user agents will not do what you want them to if you don't?
--
Some people have a "gift" link here.
Know what I want?
I want you to bu
On Friday 27 October 2006 19:34, Richard Lynch wrote:
> Your idea to use 'COUNT(Username)' is just about the ONLY part of that
> script that you are doing correctly...
>
> :-)
>
> Start reading here:
> http://phpsec.org/
>
> And the header("Location: ...") requires a full URL.
No it doesn't. but h
> Your idea to use 'COUNT(Username)' is just about the ONLY part of that
> script that you are doing correctly...
>
> :-)
:D
> And the header("Location: ...") requires a full URL.
Why?
> And you should have better error-checking, probably.
> [Though maybe you have a custom error handler not ap
Your idea to use 'COUNT(Username)' is just about the ONLY part of that
script that you are doing correctly...
:-)
Start reading here:
http://phpsec.org/
And the header("Location: ...") requires a full URL.
And you should have better error-checking, probably.
[Though maybe you have a custom erro
- Original Message -
From: "Paul Novitski" <[EMAIL PROTECTED]>
While we're talking about optimization, I'd want to check to make sure
COUNT(*) didn't ask MySQL to generate a throw-away recordset consisting of
all fields. I wonder if it would be more machine-efficient to use
COUNT(`la
>>Would it be ok to use the same code to check if customer is loged in?
>>
>>$query = mysql_query("
>>SELECT COUNT(Username) as NoOfRecords
>>FROM customers
>>WHERE Username = '$Username' AND Password =
>> '$Password'");
>>if (mysql_result($query, 0)
At 10/26/2006 11:16 AM, [EMAIL PROTECTED] wrote:
Would it be ok to use the same code to check if customer is loged in?
$query = mysql_query("
SELECT COUNT(Username) as NoOfRecords
FROM customers
WHERE Username = '$Username' AND Password = '$Password'"
> Would it be ok to use the same code to check if customer is loged in?
>
> $query = mysql_query("
>SELECT COUNT(Username) as NoOfRecords
>FROM customers
>WHERE Username = '$Username' AND Password = '$Password'");
> if (mysql_result($query, 0) == 0)
Why would you want to do that? Think about what you're trying to do. In the
first case you want a COUNT of records in the database, in the second you
just want to see if the user/password combination or whatever exist, so just
use a normal SELECT query, no need to use the wrong tool for the job...
Would it be ok to use the same code to check if customer is loged in?
$query = mysql_query("
SELECT COUNT(Username) as NoOfRecords
FROM customers
WHERE Username = '$Username' AND Password = '$Password'");
if (mysql_result($query, 0) == 0)
{
echo 'Ple
On Thu, October 26, 2006 12:57 pm, Paul Novitski wrote:
>>$query = mysql_query("
>> SELECT COUNT(*) as NoOfRecords
>> FROM customers
>> WHERE last_name = 'Smith'");
>>$result = mysql_fetch_array($query);
>>$NoOfRecords = $result['NoOfRecords'];
This
Sorry, my bad! It works jsut fine. I did misstake.
:)
>>
>>
>> > $query = mysql_query("
>> >SELECT COUNT(*) as NoOfRecords
>> >FROM customers
>> >WHERE last_name = 'Smith'");
>> > $result = mysql_result($query, 0);
>> >
--
PHP General Mailing List
At 10/26/2006 10:38 AM, [EMAIL PROTECTED] wrote:
what would be better solution to count records in table (e.g., how many
customers have last name 'Smith'):
$query = mysql_query("
SELECT COUNT(*) as NoOfRecords
FROM customers
WHERE last_name = 'Smit
Hm. There is a little problem - this doesn't work.
Warning: mysql_result(): supplied argument is not a valid MySQL result
resource in /var/www/html/xxx/tests/count.php on line 28
?
> $query = mysql_query("
>SELECT COUNT(*) as NoOfRecords
>FROM customers
>
WOW! That was fast!
:D
Thanks Dave!
-afan
> $query = mysql_query("
>SELECT COUNT(*) as NoOfRecords
>FROM customers
>WHERE last_name = 'Smith'");
> $result = mysql_result($query, 0);
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscr
$query = mysql_query("
SELECT COUNT(*) as NoOfRecords
FROM customers
WHERE last_name = 'Smith'");
$result = mysql_result($query, 0);
hi!
what would be better solution to count records in table (e.g., how many
customers have last name 'Smith'):
$query = mysql_query("
SELECT COUNT(*) as NoOfRecords
FROM customers
WHERE last_name = 'Smith'");
$result = mysql_fetch_array($query);
$No
That is some nasty code...
Anything that has repitition like that needs a substantial rewrite, but
I'm guessing that you know that, hence the e-mail.
I just knocked up the following function, powered by the magic of
recursion. It should be close to what you were trying to do.
function count_fil
here is what I tried but it doesn't work! any advice suggestions or
something?
$count = 0;
$dir = "/amrs";
$files1 = scandir($dir);
if ($files1 !== '.' && $files1 !== '..') {
foreach ($files1 as $files2){
$dir2 = "/amrs/$files2";
$files3 = scandir($dir2);
if ($files3 !== '.' && $files3 !== '..')
I have used these functions but how would I count them! here is my
attempt that doesn't work!:
$count = 0;
$dir = "/amrs";
$files1 = scandir($dir);
if ($files1 !== '.' && $files1 !== '..') {
foreach ($files1 as $files2){
$dir2 = "/amrs/$files2";
$files3 = scandir($dir2);
if ($files3 !== '.' && $f
ites.com
-Original Message-
From: Nicholas Couloute [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 25, 2006 9:41 PM
To: php-general@lists.php.net
Subject: [PHP] Counting files in directory and subdirectory!
I want a script where it will count all the amrs in a folder and it's sub
start here: http://www.php.net/readdir
check out as well: 'string functions' for finding 'amrs'
and loops to make recursive search...
t.
Nicholas Couloute wrote:
I want a script where it will count all the amrs in a folder and it's
sub folders like this setup:
amrs >
50 cent > amrs
ni
I want a script where it will count all the amrs in a folder and it's
sub folders like this setup:
amrs >
50 cent > amrs
nitty > amrs
bob > amrs
How would I do this?
~Nick Couloute
co-owner/Web Designer
Sidekick2Music.Com
--
PHP General Mailing List (http://www.php.net/)
Never mind - wasn't adding properly. Found it after all on php.net, anyway.
Thanks anyway.
-Original Message-
From: Ben Miller [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 04, 2006 5:01 PM
To: php-general@lists.php.net
Subject: [PHP] Counting in Hex
Is there a way in PHP to
Is there a way in PHP to count using hex instead of numerals so that the
following statement
$var = 237F;
$var++;
echo "$var";
would result in
2380
Thanks a bunch.
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
hahaha, thanks robin you save some seconds of mi life... it looks more
"pro" with that if...
On 8/17/05, Robin Vickery <[EMAIL PROTECTED]> wrote:
> On 8/17/05, Ing. Josué Aranda <[EMAIL PROTECTED]> wrote:
> > OK this the little function i made to solve this..
> >
> > function countNested($arra
On 8/17/05, Ing. Josué Aranda <[EMAIL PROTECTED]> wrote:
> OK this the little function i made to solve this..
>
> function countNested($array){
> foreach($array as $value){
> if(is_array($value))
> $total=$this->countNested($value)+$total;
> }els
OK this the little function i made to solve this..
[CODE]
function countNested($array){
foreach($array as $value){
if(is_array($value))
$total=$this->countNested($value)+$total;
}else{
$total=$total+1;
}
}
On 8/16/05, Ing. Josué Aranda <[EMAIL PROTECTED]> wrote:
>
> The number of the branches is not always the same.. (it depends on the
> query).. when i use count($array, COUNT_RECURSIVE) for nested arrays..
> it give to me the total including the nodes in the branches ( in this
> case 28).. now here
Ing. Josué Aranda wrote:
>Hi to everyone..
>
>now i have a little problem counting an nested array. Im using it to
>fill a Java TreeView... it looks like this:
>
>[snip]
>
>The number of the branches is not always the same.. (it depends on the
>query).. when i use count($array, COUNT_RECURSIVE) fo
Hi to everyone..
now i have a little problem counting an nested array. Im using it to
fill a Java TreeView... it looks like this:
[1] => Array
(
[1] => Array
(
[1] => Array
(
[1] => LEC
On Tuesday 17 May 2005 18:00, Merlin wrote:
> I am trying to find a way to count the number of times (if any) words
> are inside a string.
explode()
array_count_values()
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting
On Tue, 2005-05-17 at 06:00, Merlin wrote:
> Hi there,
>
> I am trying to find a way to count the number of times (if any) words are
> inside
> a string. So I played around with ereg, preg_match_all and so on, but could
> not
> put together a working code.
Maybe something like this?
';
fore
On Tuesday 17 May 2005 13:00, Merlin wrote:
> Hi there,
>
> I am trying to find a way to count the number of times (if any) words are
> inside a string. So I played around with ereg, preg_match_all and so on,
> but could not put together a working code.
>
> Can anybody help me on that?
>
> This is
Hi there,
I am trying to find a way to count the number of times (if any) words are inside
a string. So I played around with ereg, preg_match_all and so on, but could not
put together a working code.
Can anybody help me on that?
This is the current code:
function count_words($str, $words) {
if
You basically dont need the for loop all you have to do is increment the
value of the variable by one each time in the while loop
Devraj
Louie Miranda wrote:
Hi, im trying to create a number loop on a table where the data came
in a database.
I have tried the for "loop" and counted $countCards_res
Hi, im trying to create a number loop on a table where the data came
in a database.
I have tried the for "loop" and counted $countCards_result from the
table where im going to get all the data.
## code ##
while ($profile->fetchInto($row)) {
for ($i = 1; $i <= $countCards_result; $i++) {
$num = $
On Thu, 2004-12-16 at 14:28 +0800, Louie Miranda wrote:
> $string = "function yes good";
> $display = count_chars($string);
>
> echo $display;
> ?>
>
> i know this is wrong, but how can i count chars used here?
php.net/strlen ?
-Robby
--
/***
* Robby Russel
1 - 100 of 215 matches
Mail list logo