Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Errore su classe "istanceof"

    Codice PHP:
    //classe per il tag table
    class table implements produce_html {

        private 
    $output "\n<table ";
        private 
    $dati = array();
        private 
    $attributi = array();

        public function 
    __construct($attributi = array()) {
            if(
    count($attributi) < 1) {
                throw new 
    Exception('Numero di attributi passati errato, inserisci almeno id!');
            }
            
    $this->attributi $attributi;
        }

        public function 
    dati($dati = array()) {
            if(
    count($dati) < 1) {
                throw new 
    Exception('Non hai passato dei dati per la tabella!');
            }
            
    $this->dati $dati;
        }

        public function 
    genera_html() {
            foreach(
    $this->attributi AS $attributo=>$valore) {
                
    $this->output .= $attributo '="' $valore "\">\n";
            }
            foreach(
    $this->dati AS $dato) {
                
    $dato = ($dato istanceof produce_html) ? $dato->genera_html() : $dato;
                
    $this->output .= "\n<tr><td>" $dato "</td></tr>\n";
            }
            
    $this->output .= "\n</table>\n\n";
            return 
    $this->output;
        }

    Ragazzi mi dice:
    Parse error: syntax error, unexpected T_STRING

    e la riga incriminata è
    Codice PHP:
                $dato = ($dato istanceof produce_html) ? $dato->genera_html() : $dato
    Non vorrei che non mi riconosca "istanceof" e mi legga "produce_html" come stringa.. Ma mi pare strano.. vedete qualche apice di troppo??

    Grazie grazie :master:
    Questa volta, più che un voto.. è favoreggiamento.

  2. #2
    Codice PHP:
    ($dato instanceof produce_html

    Without faith, nothing is possible. With it, nothing is impossible
    http://ilwebdifabio.it

  3. #3

  4. #4
    ma li mortacciiiiiiii...



    Vi adoro
    Questa volta, più che un voto.. è favoreggiamento.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.