You are here: array help « All PHP « IT news, forums, messages
array help

Posted by Darrell on 12/02/07 01:13

I am trying to write a function but am stopped at square one.
This snippet

<?php
error_reporting(E_ALL);
$Buf = file("bsshort2.txt");
print_r ($Buf);
$aKeys = array_keys($Buf);
print_r ($aKeys);
?>

prints out the file with all of the keys and then prints all of the keys as
expected.

This version

<?php
error_reporting(E_ALL);
$Buf = file("bsshort2.txt");
print_r ($Buf);
$aKeys = array_keys($Buf,("chuck"));
print_r ($aKeys);
?>

prints out the file with all of the keys and then prints Array ( )

This is part of the array that is printed

[9] => Beautiful night already 68, great sleeping weather.

[10] => chuck [11] =>

and this is from the file that is being read

I don't want anybody dying on my watch PEROID. I just don't like LTs.
hollering at me,GRIN<P>
Beautiful night already 68, great sleeping weather.<P>
chuck
<HR>

I would expect to see

Array ( [11] => 11)

What I really want to search for is <HR> but originally thought I was
having trouble searching for <HR> so I tried "chuck".



Where am I going wrong?

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация