![]() |
|
#1
|
|||
|
|||
isThere pointers in PHPis pointers available in PHP like that in C...can i get the address of variables using pointers ...
|
|
#2
|
|||
|
|||
Re: isThere pointers in PHP<?php
/* REVERSE.PHP */ $str = ""; /* Buffer to hold reverse string */ reverse("cat", &$str); /* Reverse the string "cat" */ printf("reverse (\"cat\") = %s\n", $str); /* Display result */ reverse("noon", &$str); /* Reverse the string "noon" */ printf("reverse (\"noon\") = %s\n", $str); /* Display result */ function reverse($before, $after) { $after=$before; /* Expand $str to length, preventing array */ $len = strlen($before); for ($j=$len-1, $i=0; $j>=0; $j--, $i++) $after{$i} = $before{$j}; } ?> /* REVERSE.C */ #include <stdio.h> /* Function Prototype */ reverse (); main () { char str [100]; // Buffer to hold reverse string reverse("cat", str); // Reverse the string "cat" printf("reverse (\"cat\") = %s\n", str); // Display reverse("noon", str); // Reverse the string "noon" printf("reverse (\"noon\") = %s\n", str); // Display } reverse (before, after) char *before; // A pointer to the source string char *after; // A pointer to the reversed string { int i; int j; int len; len = strlen (before); for (j = len - 1, i = 0; j >= 0; j--, i++) // reverse loop after[i] = before[j]; after[len] = NULL // NULL terminate reversed string } |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| uisng php to display php | dopee | MySQL / PHP Forum | 6 | 14-May-2004 18:40 |
| php software | dopee | MySQL / PHP Forum | 0 | 04-May-2004 11:26 |
| [Linux] Installing PHP --with-mcrypt | JdS | Web Hosting Forum | 0 | 20-Aug-2003 08:40 |
| Windows: From only £20p/y,Linux: from $10p/m. ASP, ASP.NET, PHP, Free MySQL, +More | EyotaHosts | Web Hosting Advertisements & Offers | 0 | 28-Jun-2003 13:54 |
| All the big PHP script collections that matter | jrobbio | MySQL / PHP Forum | 5 | 06-Jun-2003 16:14 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The