|
|
|
|
 |
|  |
 |
Dodo |
| [PHP] problema da newbie |
10-05-2004 19:09 |
|
 |
Dodo |
lunatico

Registered: Jul 2002
Posts: 2340 (0.27 al dì)
Location: in una fibra ottica
Corso: Com Dig
Anno: 3+1 :P
Time Online: 42 Days, 7:55:56 [...]
Status: Offline
Edit | Report | IP: Logged |
[PHP] problema da newbie
premettendo che oggi ho iniziato a guardare PHP quindi non vi scandalizzate per la "complessità" del codice 
PHP:
<?php
function addFive( $num )
{
$num += 5;
}
$orignum = 10;
addFive(&$orignum);
print( $orignum );
?>
non riesco a capire perchè mi da il seguente problema:
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of addfive(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\programmi\easyphp1-7\www\prova1.php on line 12
15
quale può esser il problema.. il codice è preso da un libro tra l'altro quindi non so spiegarmi cosa può essere
__________________
E' meglio essere ottimisti ed avere torto piuttosto che pessimisti ed avere ragione.
Albert Einstein
|
|
10-05-2004 19:09 |
|
|
|  |
 |
ripe |
| Non conosco il php, ma dal messaggio di errore mi ... |
10-05-2004 19:15 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.10 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
Non conosco il php, ma dal messaggio di errore mi pare di capire che il problema stia nel fatto che stai passando alla funzione addFive un parametro per riferimento, e non per valore (cosa che a quanto pare non si può fare...). Prova a vedere come si può passare il parametro num per valore (ad esempio in ASP si fa facendo precedere al nome del parametro le parole chiave ByRef o ByVal).
E' solo un consiglio teorico perchè non conosco il php... magari ti è utile lo stesso! 
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
|
|
10-05-2004 19:15 |
|
|
|  |
 |
ripe |
| addFive($orignum);
... |
10-05-2004 19:15 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.10 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
addFive($orignum);
Forse la modifica giusta è questa... 
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
|
|
10-05-2004 19:15 |
|
|
|  |
 |
holylaw |
| Re: [PHP] problema da newbie |
10-05-2004 19:42 |
|
 |
holylaw |
.grande:maestro.

Registered: Feb 2003
Posts: 3142 (0.38 al dì)
Location: milano
Corso: Magistrale Informatica
Anno: bella domanda
Time Online: 88 Days, 5:30:09: [...]
Status: Offline
Edit | Report | IP: Logged |
Re: [PHP] problema da newbie
la & per il passaggio per referenza delle variabili bisogna metterlo nel prototipo della funzione, non quando chiami la funzioni....
PHP:
<?php
function addFive( &$num )
{
$num += 5;
}
$orignum = 10;
addFive($orignum);
print( $orignum );
?>
__________________
La mia epoca ed io non siamo fatti l'uno per l'altro:questo è chiaro. Ma è da vedere chi di noi due vincerà il processo di fronte al tribunale dei posteri.
AV MJØDEN VART DU VIS OG KLOK, SÅ DREKKA MER!!!!
Le persone sagge parlano perché hanno qualcosa da dire.
Le persone sciocche perché hanno da dire qualcosa.
|
|
10-05-2004 19:42 |
|
|
|  |
 |
korn |
| [CODE]
... |
10-05-2004 20:02 |
|
 |
korn |
SET FIRE!

Registered: Jun 2002
Posts: 5793 (0.67 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline
Edit | Report | IP: Logged |
code:
<?php
function addFive( $num )
{
return $num += 5;
}
$orignum = 10;
$orignum = addFive($orignum);
print( $orignum );
?>
__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.
|
|
10-05-2004 20:02 |
|
|
|  |
 |
DeepBlue |
| [QUOTE][i]Originally posted by korn [/i]
... |
10-05-2004 20:05 |
|
 |
DeepBlue |
tired guy

Registered: Sep 2003
Posts: 4258 (0.52 al dì)
Location: CSN
Corso: Info tlc
Anno:
Time Online: 52 Days, 8:40:31 [...]
Status: Offline
Edit | Report | IP: Logged |
Originally posted by korn
code:
<?php
function addFive( $num )
{
return $num += 5;
}
$orignum = 10;
$orignum = addFive($orignum);
print( $orignum );
?>

Ci vuole anche il return, se no la funzione se lo mangia
Le funzioni sono bastarde
__________________
~ get Debian! ~ get FreeBSD! ~ get OpenBSD! ~
|
|
10-05-2004 20:05 |
|
|
|  |
 |
holylaw |
| boh io ho provato sia come ha detto Dodo, sia come ... |
10-05-2004 20:06 |
|
 |
holylaw |
.grande:maestro.

Registered: Feb 2003
Posts: 3142 (0.38 al dì)
Location: milano
Corso: Magistrale Informatica
Anno: bella domanda
Time Online: 88 Days, 5:30:09: [...]
Status: Offline
Edit | Report | IP: Logged |
boh io ho provato sia come ha detto Dodo, sia come ho detto io e vanno tutte e 2....
__________________
La mia epoca ed io non siamo fatti l'uno per l'altro:questo è chiaro. Ma è da vedere chi di noi due vincerà il processo di fronte al tribunale dei posteri.
AV MJØDEN VART DU VIS OG KLOK, SÅ DREKKA MER!!!!
Le persone sagge parlano perché hanno qualcosa da dire.
Le persone sciocche perché hanno da dire qualcosa.
|
|
10-05-2004 20:06 |
|
|
|  |
 |
AlphaGamma |
| Se dovete chiamarlo per indirizzo, scrivete a [ema ... |
11-05-2004 00:27 |
|
 |
AlphaGamma |
.piano ma pieni.

Registered: Jun 2002
Posts: 6732 (0.78 al dì)
Location:
Corso: Eh?
Anno: Io cosa?
Time Online: 21 Days, 21:22:01: [...]
Status: Offline
Edit | Report | IP: Logged |
Se dovete chiamarlo per indirizzo, scrivete a korn@dsy.it
Se dovete chiamarlo per valore, chiamatelo Maestro.

(ok è vecchia)
__________________
Attenzio', concentrazio', ritmo e VITALITÀ
|
|
11-05-2004 00:27 |
|
|
|  |
 |
JaM |
| Alpha sei un nerdaccio :asd:
... |
11-05-2004 08:37 |
|
 |
JaM |
######

Registered: Jun 2002
Posts: 3604 (0.42 al dì)
Location: everywhere, anywhere, elsewhere...
Corso: ComDig
Anno: dott.??
Time Online: 62 Days, 16:55:46 [...]
Status: Offline
Edit | Report | IP: Logged |
Alpha sei un nerdaccio 
cmq korn rulez! 
|
|
11-05-2004 08:37 |
|
|
|  |
 |
korn |
| :rotfl: ... |
11-05-2004 08:38 |
|
 |
korn |
SET FIRE!

Registered: Jun 2002
Posts: 5793 (0.67 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline
Edit | Report | IP: Logged |

__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.
|
|
11-05-2004 08:38 |
|
|
|  |
 |
Dodo |
| grazie a tutti, grazie korn :D ... |
11-05-2004 10:40 |
|
 |
Dodo |
lunatico

Registered: Jul 2002
Posts: 2340 (0.27 al dì)
Location: in una fibra ottica
Corso: Com Dig
Anno: 3+1 :P
Time Online: 42 Days, 7:55:56 [...]
Status: Offline
Edit | Report | IP: Logged |
grazie a tutti, grazie korn 
__________________
E' meglio essere ottimisti ed avere torto piuttosto che pessimisti ed avere ragione.
Albert Einstein
|
|
11-05-2004 10:40 |
|
|
|  |
 |
Angra |
| Una domanda... in quale corso di Com.Dig studierem ... |
11-05-2004 10:44 |
|
 |
Angra |
.arcimaestro.

Registered: Jan 2004
Posts: 390 (0.05 al dì)
Location: Varese
Corso: Comunicazione Digitale
Anno: Basta basta!Finito!Stop!
Time Online: 49 Days, 19:30:01: [...]
Status: Offline
Edit | Report | IP: Logged |
Una domanda... in quale corso di Com.Dig studieremo PhP?
Grazie
|
|
11-05-2004 10:44 |
|
|
|  |
 |
ripe |
| Nessuno? :asd: ... |
11-05-2004 11:02 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.10 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
Nessuno? 
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
|
|
11-05-2004 11:02 |
|
|
|  |
 |
korn |
| [QUOTE][i]Originally posted by Angra [/i]
... |
11-05-2004 11:05 |
|
 |
korn |
SET FIRE!

Registered: Jun 2002
Posts: 5793 (0.67 al dì)
Location: Milano
Corso: Comunicazione Digitale
Anno: 1°! ....fuori corso :(
Time Online: 37 Days, 5:56:42 [...]
Status: Offline
Edit | Report | IP: Logged |
Originally posted by Angra
Una domanda... in quale corso di Com.Dig studieremo PhP?
Grazie
Nessuno.
Potresti provare con TecWeb, ma non è un corso di PHP, ti parla delle tecnologie web in generale e mi pare che la nuova edizione sia orientata maggiormente verso XML e compagnia bella.
Però se hai fatto Java (o conosci il C) non avrai problemi a impararlo da solo, come impostazione è simile.
__________________
» Collect some stars to shine for you, and start today ‘cause there are only a few. _ (In Flames)
» Don't stop for nothing, it's full speed or nothing! I'm taking down, you know, whatever is in my way! _ ('tallica)
» I am my own god, I do as I please. _ (Pain)
» Ninetynine, ninetynine knives! Ninetynine knives inside! Nobody gets out alive! _ (The Haunted)
Web: http://www.negativesignal.com - ICQ# 171585477 - Death to software patents! And TCPA too! "e uno!", diceva il boia.
|
|
11-05-2004 11:05 |
|
|
|  |
 |
Angra |
| Non ci sono neanche corsi Fse? ... |
11-05-2004 11:28 |
|
 |
Angra |
.arcimaestro.

Registered: Jan 2004
Posts: 390 (0.05 al dì)
Location: Varese
Corso: Comunicazione Digitale
Anno: Basta basta!Finito!Stop!
Time Online: 49 Days, 19:30:01: [...]
Status: Offline
Edit | Report | IP: Logged |
Non ci sono neanche corsi Fse?
|
|
11-05-2004 11:28 |
|
|
|  |
 |
| All times are GMT. The time now is 13:13. |
|
|
 |
|
 |
|
|
|  |
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
|
|
|
|
|
|