note 53995 deleted from function.strncasecmp by derick

From: Date: Tue, 30 Aug 2005 11:28:42 +0000
Subject: note 53995 deleted from function.strncasecmp by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-94420@lists.php.net to get a copy of this message
Note Submitter: softxmercats at boqueria dot info ---- 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]); }

« previous php.notes (#94420) next »