GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Jul-2004, 04:35
sajuat sajuat is offline
Awaiting Email Confirmation
 
Join Date: Jul 2004
Posts: 6
sajuat is on a distinguished road

isThere pointers in PHP


is pointers available in PHP like that in C...can i get the address of variables using pointers ...
  #2  
Old 20-Nov-2006, 09:18
nexuslite nexuslite is offline
New Member
 
Join Date: Nov 2006
Posts: 3
nexuslite is on a distinguished road

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 GIDBlogProblems with the Navy (Enlisted) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 10:36.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.