Page 1 of 1

explode function

Posted: Thu Nov 28, 2002 4:11 pm
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>';
  }
?>

Posted: Thu Nov 28, 2002 4:37 pm
by volka
lenght -> length

Do you mean int count ( mixed var)?

Posted: Fri Nov 29, 2002 1:53 am
by twigletmac
Or its alias sizeof()?

Mac

Posted: Sun Dec 01, 2002 4:03 am
by jamal
I changed the error to length but it did not work.
Any suggestion???

Posted: Sun Dec 01, 2002 4:21 am
by volka
there is no function called length in php. try count() or sizeof() ;)