Jump to content

henriques

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

henriques's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I tried to understand the functioning of your code, and as I am novice in php, did not understand much. I think you are complicating a simple answer, I just wanted the difference between (A and B). For you it's easy to make such changes. A = (1, 2, 3); B = (1); $response = missing number 2 and 3 in $B; Without philosophy, pure and simple .... It has a way? If yes, could you help me? txs.
  2. I appreciate all yours efforts but so far nobody solved my problem, does not seem so easy as I thought. I have, $a = '1, 2, 3, 4, 5 ' and $b = '1, 2, 3'; comparing these two variables would have the $result=(4 and 5) I wanted only the result of comparison and not all of the array theory. Simple is that $a e $b outcome (4 and 5) any candidate? :'(
  3. what do you mean? what i really need is put two variables in an array. as in the example above. I thought it was something easy to do, but apparently is not.
  4. what do you mean? what i really need is put two variables in an array. as in the example above. I thought it was something easy to do, but apparently is not.
  5. thank you man!! lets make it simple. I have 2 variables: $mike = "'1', '2', '3', '4', '5'"; $nike = " '1', '2', '3'"; How can i put then in array and get the comparation results.
  6. The reason i need to know the dates they are missing is: I have a hour tracking system, and I need to know the days that the person worked or not. When generating the report, must generate the time and date that the person did not appear to work. so, it can be deduct in the 40 hours weekly worked. Something like that. txs for you reply.
  7. still not working! i don´t think that the variable $a[] or $b[] its working, it retun nothing with echo or print_r(). $a[] should return '1', '2', '3', '4', '5', '6', '7' $b[] should return '1', '2', '3', '4' the result $dif it should be 5 6 7
  8. still not working! i don´t think that the variable $a[] or $b[] its working, it retun nothing with echo or print_r(). $a[] should return '1', '2', '3', '4', '5', '6', '7' $b[] should return '1', '2', '3', '4' the result $dif it should be 5 6 7
  9. txs it´s not working? how to make this to work? <? $a[] = "'1', '2', '3', '4', '5', '6', '7'"; for($i=1;$i<5;$i++){ $b[] = $i; } $ar1 = array('a' => $a[]); $ar2 = array('b' => $b[]); $dif = array_diff($ar1, $ar2); foreach($dif as $k => $v)( echo "$dif [$k]<br />" ) ?>
  10. thanks for responding. yes I did, but now I am having another problem. How to put a variable within an array eg: for($i=1;$i<10;$i++){ $v2 = date("Y-m-$i") } $array2 = array('b' => $v2); print_r($array2); //result gives me 10 i tried with implode, but no success. txs.
  11. hi all, I need to fill the dates that are missing in a mysql table. eg: If a month is 31 days, must know the dates that are missing in the month. I thought of making a comparison using arrays, which seems to be the right way, but for some reason I'm not able to do it. maybe something like this for ($ a = 1; $ a <date (j), $ a) ( if (strlen ($ a) =='1 ') ($ a = "0 $ to" ) which generates 01 to the date of the current day (today). in other words, must compare two strings and show what is missing. like, array1 = array ( 'a' => 1,2,3,4); array2 = array ( 'b' => 1,3,4); using the code: ? php $ array1 = array ( 'a' =>'1 ', 2','3 ','4'); $ array2 = array ( 'a' =>'1 ','3','4); $ difference = array_diff ($ array1, $ array2); foreach ($ difference as $ k => $ v) ( echo "$ difference [$ k] <br />"; ) result will be 2, which is missing in array2 ?> in other words, must get across the table column (date) put in (array1) generate a code dates of 01 until the present day and put in the (array2) for ($ a = 1; $ a <date (j), $ a) ( if (strlen ($ a) =='1 ') ($ a = "0 $ to" $ d = date ( "Y-m-$ to"); $ s = '$ d', "; $ array2 = array ( 'b' => $ s); ) and compare the two arrays, which shows what dates are missing, then I used the mysql insert to fill out the dates that are missing. I think it is just that. It should be a simple thing to do for those who knows.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.