Jump to content
Fórum Script Brasil
  • 0

Retirando Partes Únicas De Um Array


ppgsalomao

Question

Como fazer para tirar apenas o que quero de um array ??

Tentei com array_splice mas não consegui !

O Código

//Recebe os CheckBox

$check0 = $HTTP_POST_VARS['check0'];

$check1 = $HTTP_POST_VARS['check1'];

$check2 = $HTTP_POST_VARS['check2'];

$check3 = $HTTP_POST_VARS['check3'];

$check4 = $HTTP_POST_VARS['check4'];

$check5 = $HTTP_POST_VARS['check5'];

$check6 = $HTTP_POST_VARS['check6'];

$check7 = $HTTP_POST_VARS['check7'];

$objs = array("0","1","2","3","4","5","6","7");

if (!isset($check0)) {

$objs = array_splice($objs, 0, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check1)) {

$objs = array_splice($objs, 1, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check2)) {

$objs = array_splice($objs, 2, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check3)) {

$objs = array_splice($objs, 3, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check4)) {

$objs = array_splice($objs, 4, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check5)) {

$objs = array_splice($objs, 5, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check6)) {

$objs = array_splice($objs, 6, 1);

$join = join(",",$objs);

echo $join;

}

if (!isset($check7)) {

$objs = array_splice($objs, 7, 1);

$join = join(",",$objs);

echo $join;

}

E não da certo !!

Como faço ??

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...