Hello All,
I want to know if there is a function in php that does similar job of the strcat function in C!!
i want to declare a variable $data and concatenate data in it? How is this done in php
I have another question about the function sleep(), i am using php 5.2.5 but this function doesnt work, does anyone knows why?
strcat in php?
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: strcat in php?
I want to know if there is a function in php that does similar job of the strcat function in C!!
i want to declare a variable $data and concatenate data in it? How is this done in php
Code: Select all
$data = 'Hello';
$data .= ' ';
$data = $data.'World';
No, and it works perfectly on a wide range of platforms and PHP versions that I'm using.I have another question about the function sleep(), i am using php 5.2.5 but this function doesnt work, does anyone knows why?
More details might help.... e.g. how do you know it's not working, what does it do, etc.
- xpgeek
- Forum Contributor
- Posts: 146
- Joined: Mon May 22, 2006 1:45 am
- Location: Kyiv, Ukraine
- Contact:
Re: strcat in php?
Try this, if it dosn't hep pls show you example of code:dialla123 wrote:Hello All,
I have another question about the function sleep(), i am using php 5.2.5 but this function doesnt work, does anyone knows why?
Code: Select all
// current time
echo date('h:i:s') . "\n";
// sleep for 10 seconds
sleep(10);
// wake up !
echo date('h:i:s') . "\n";
Re: strcat in php?
Thank you very much guys for your help!
the function sleep() is working now!
Anyway, i have another question about php, lets say i have a string of charachters, eg. $data = "AAFCGDS"
There is a function in C language getc(), that returns one character of the string and move to the next charachter.
Is there a function in php that does the same thing?!
the function sleep() is working now!
Anyway, i have another question about php, lets say i have a string of charachters, eg. $data = "AAFCGDS"
There is a function in C language getc(), that returns one character of the string and move to the next charachter.
Is there a function in php that does the same thing?!
Re: strcat in php?
No, but there are plenty of alternatives. substr() with a loop strlen() times for example, or you can treat a string like an array of characters (eg $string[0] returns the first character)..
- xpgeek
- Forum Contributor
- Posts: 146
- Joined: Mon May 22, 2006 1:45 am
- Location: Kyiv, Ukraine
- Contact:
Re: strcat in php?
In much cases you don't need it!dialla123 wrote:Thank you very much guys for your help!
the function sleep() is working now!
Anyway, i have another question about php, lets say i have a string of charachters, eg. $data = "AAFCGDS"
There is a function in C language getc(), that returns one character of the string and move to the next charachter.
Is there a function in php that does the same thing?!
But, you can use for to loop through characters accessing by index $data[$i];
Or write you own getc