Arduino with rfid RC522 module

Hello guys ! i’m new with arduino and i’m trying to write some data from a php application !
the probleme is when i pass a variable to be written in a char variable ! it gives me an error !
for exemple :

String var = "Hello word … ";
int stp=sizeof(var);
char number[16];
for (int a=0;a<=stp;a++)
{
number[a]=var[a];
}
int writed=writeBlock(block, number);

(The result i get is : Hello wor???;

But when i use this :

char number[16] = {“Hello Word … !”};
int writed=writeBlock(block, number);

it works normaly, but it’s a static methode !

Any help pleaase !
i want to write a string dynamicly … !
thank you in advance…!

Use var.length() to determine the length of the String. To my knowledge, sizeof returns the number of bytes of the String object, not the length of the text.

Even better, forget that the String class exists and use normal c-strings (character arrays teinated by '\O'); might prevent difficult to trace bugs in future code.

Please explain "static methode".

Please get someone else to type for you. Put your hands in your pockets while you tell them what to type. All the arm-waving you are doing is NOT communicating.