note 53995 added to function.strncasecmp
| From: | softxmercats at boqueria dot info | Date: | Mon, 20 Jun 2005 13:09:27 +0000 |
| Subject: | note 53995 added to function.strncasecmp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90689@lists.php.net to get a copy of this message | ||
we find strncasecmp($str1, $str2, length.to.compare) very usefull.
-- here is an example in which I define what type of document
will go in the general content area of PHP menu driven
web page --
<!--texto -->
<?php
// formato de en medio
if (strncasecmp($TipoOpciones[$Modulo],".html", 5) == 0)
include($Opciones[$Modulo] . ".html" ); // portada
else include("MoldeMod.php"); // portada
?>
p.s. - 5 is the length of the text ".html" if it finds this menu option
is ".html" it will read it and include inserting it, if not
it will execute it's original form "ModeMod.php", which
is an image oriented PHP programme.
from the beggining:
<?php
// clases
// i/o
// formateo
class RgBase3
{
// funciones de lectura / escritura
function LeeFichero($FileName)
{
if (!$fp = fopen($FileName, "r"))
{ die("fallo al abrir .. $FileName") ; }
$s01 = fread($fp, filesize($FileName));
fclose($fp);
return $s01;
}
}
?>
--- spreadsheet Opciones.csv ---
option name(0) description(1) sub-menus(2) doctype(3)
-------- ----------------------------- -----------------------------
---------
NOVEDADES Noticias y Novedades Servicios,Temporada .html
*************
complete code:
$s01 = $Bs->LeeFichero("Opciones.csv"); // fichero prinicipal de la web
$s01 = strtr($s01, '"', " ");
$Matriz01 = explode($RMK, $s01);
$NumOpciones = sizeof($Matriz01)-1;
for ($i=0; $i<$NumOpciones; $i++)
{
$Matriz02 = explode($FMK, $Matriz01[$i]);
$Opciones[$i] = trim($Matriz02[0]);
$DescOpciones[$i] = trim($Matriz02[1]);
$SubOpciones[$i] = trim($Matriz02[2]);
$TipoOpciones[$i] = trim($Matriz02[3]);
}
----
Manual Page -- http://www.php.net/manual/en/function.strncasecmp.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53995
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53995&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53995&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53995&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53995&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53995&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53995&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53995&report=yes
Search -- http://master.php.net/manage/user-notes.php