explode function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamal
Forum Commoner
Posts: 57
Joined: Sat Oct 26, 2002 7:53 pm
Location: London

explode function

Post by jamal »

This is the error I got when I tried to execute the code below:
Fatal error: Call to undefined function: lenght()
Please I need your help please

Code: Select all

<form action="explode.php">
Enter a String:<input type="text" name="strn"><br>
Enter the delimiter:<input type="text" name="delimiter"><br><br>
<input type="submit" value="Split!">
</form>


************* explode.php ********************

Code: Select all

<?php
 $string = $_GETї"strn"]; 
 $delimiter = $_GETї"delimiter"];
 $arrayofstring = explode ($delimiter,$string);
 for ($i=0;$i<lenght($arrayofstring);$i++)
  {
   echo $arrayofstringї$i].'<br>';
  }
?>
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

lenght -> length

Do you mean int count ( mixed var)?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Or its alias sizeof()?

Mac
jamal
Forum Commoner
Posts: 57
Joined: Sat Oct 26, 2002 7:53 pm
Location: London

Post by jamal »

I changed the error to length but it did not work.
Any suggestion???
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

there is no function called length in php. try count() or sizeof() ;)
Post Reply