Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Notice: Undefined offset: 7 in........php
Old 04-07-2010, 03:10 AM Notice: Undefined offset: 7 in........php
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi Forum,

I am trying to run array_unique() function of php................however at the run time it occurs an error :

Notice: Undefined offset: 7 in ......on line 8

Here's the code......what I am doing.

PHP Code:
<?php 
$dirty 
= array('danish','mukesh','braden1','shadab','bev','john','kirsten','braden1');

$clean array_unique($dirty);

for(
$i=0$i<=count($clean); $i++)
    {
        echo 
$clean[$i] . "<br />";
    }
?>
Any of your suggestions would be appreciated.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-07-2010, 03:44 AM Re: Notice: Undefined offset: 7 in........php
Sergey Popov's Avatar
Junior Talker

Posts: 4
Name: Sergey Popov
Trades: 0
It's simple. Must be:

PHP Code:
for($i=0$i<count($clean); $i++) 
__________________
freelance
Please login or register to view this content. Registration is FREE
for hire
Please login or register to view this content. Registration is FREE
Sergey Popov is offline
Reply With Quote
View Public Profile Visit Sergey Popov's homepage!
 
Old 04-07-2010, 04:17 AM Re: Notice: Undefined offset: 7 in........php
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Thanks Sergey,

Its working now.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 04-07-2010, 05:41 AM Re: Notice: Undefined offset: 7 in........php
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Just for the explanation, the array index is 0 based.
Meaning that if count() gives you 8, the array goes from 0 to 7; not 1 to 8.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Reply     « Reply to Notice: Undefined offset: 7 in........php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40205 seconds with 12 queries