php first element of the array isnt sorted -


i try sort elements of array in php .i explode elements .txt file , elements sorted except [0] indexed element.why happens in code below?

$filemanaviki = fopen("manaviki.txt","r") or die ("unable open file!"); $anagnosi = fread($filemanaviki,filesize("manaviki.txt")); $manaviki = explode(',',$anagnosi); sort($manaviki); $mikos=count($manaviki); for($i=0; $i < $mikos;$i++){     echo "<p id='testing' onclick='createnew(this.innerhtml);'>{$manaviki[$i]}</p>"; }  ?> 

in .txt file have values

Πατάτες,Λάχανο,Κρεμμύδι,Πιπεριές,Φασολάκια,Γίγαντες,Ντομάτες 

i'm going assume manaviki.txt file saved bom characters in top of it, recognised utf-8. try resaving file without bom character (efficiently interpreted ansi utf-8 in programs notepad++) sort don't confused strange characters in top (bom) applied first element.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

django - CSRF verification failed. Request aborted. CSRF cookie not set -