php array i have an array and i need to place some values in the array

user2226832

I have an function called send message

function sendMessage(){
    $content = array(
        "en" => 'value1'
    );
    $headings   = array(
        "en" => 'value2'
    );
    $hashes_array = array();

    fields = array(
        'app_id' => "31fe2347-5f39-4d9f-2222-79bf542f00f9",
        'included_segments' => array(
            'All'
        ),
        'data' => array(
            "foo" => "bar"
        ),
        'contents' => $content,
        'headings' => $headings,
        'url' => 'http://www.999999.in/view.php?id=[id]',
        'chrome_web_image'  => 'http://www.99999.in/admin/user_images/[userPic]',        
    );

And I have an array ready

Array(
    [id] => 498
    [value2] => యూట్యూబ్‌లో “భరత్ అనే నేను” అన్ కట్ సీన్లు..!
    [value1] => కొరటాల శివ దర్శకత్వం లో సూ...
    [value3] => 525722.jpg
) 

Now just I need to place array values in function

Please help me on this I tried all echo values

Barmar

Pass the array as an argument to the function, then access the elements.

function sendMessage($array) {
    $content      = array(
        "en" => $array['value1']
        );
    $headings   = array(
        "en" => $array['value2']
        );
    $hashes_array = array();

    $fields = array(
        'app_id' => "31fe2347-5f39-4d9f-2222-79bf542f00f9",
        'included_segments' => array(
            'All'
            ),
        'data' => array(
            "foo" => "bar"
            ),
        'contents' => $content,
        'headings' => $headings,
        'url' => 'http://www.999999.in/view.php?id=' . $array['id'],
        'chrome_web_image'  => 'http://www.99999.in/admin/user_images/' . $array['value3'],        

        );
    print_r($fields);
}

DEMO

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How can I check if the array of objects have duplicate property values?

From Dev

I have an array of objects, and I need to find the person that is associated with a specific value

From Dev

PHP Multidimensional array - do I need this key or not?

From Dev

How can I modify array fields in place?

From Dev

I have this query that gives me the following php array data:

From Dev

I have passed an array in session variable. I need to pass key strokes to it to return values

From Dev

I have a array with 0 and 1 values. If I multiply this with -1, it results in empty array. Why?

From Dev

I have an array of URLs that need to be passed into anchor tags

From Dev

need to access 3 values in a php array that contains 20, is a 3d array and I need to access the same values 60 times

From Dev

I need to add data into an Array

From Dev

How can I save values in a array when I have a foreach?

From Dev

I need to check a JavaScript array to see if there are any duplicate values.

From Dev

Checking values for an array for every $i

From Dev

Search multidimensional array and place found values in new array (PHP)

From Dev

Do I need to initialise every key of a multidimensional array in PHP?

From Dev

I have some remote images I'm loading into an NSMutableArray but the array isn't populated by the time I need it

From Dev

I have a single array into multidimensional array

From Dev

I have JSON Object, with this object i need to find the ID Number of "xxxEmployeeCategory "T" and list the list in an Array

From Dev

How do I go from an array of key => "array of values" to an array of an array of "key => values" in php

From Dev

I need to pull an individual string from a PHP array

From Dev

I need to create and sort new array with php

From Dev

How can I add keys to a PHP array, if I need those keys to have a value (passed from a DB) at the same time?

From Dev

I have this query that gives me the following php array data:

From Dev

I have passed an array in session variable. I need to pass key strokes to it to return values

From Dev

how to get some values of an array php

From Dev

I have an array but i want to check it separated

From Dev

Loop into an array if I have a key in PHP

From Dev

I need to loop this array

From Dev

Create new array from two array in with i will count the number of occurence some values in php

Related Related

  1. 1

    How can I check if the array of objects have duplicate property values?

  2. 2

    I have an array of objects, and I need to find the person that is associated with a specific value

  3. 3

    PHP Multidimensional array - do I need this key or not?

  4. 4

    How can I modify array fields in place?

  5. 5

    I have this query that gives me the following php array data:

  6. 6

    I have passed an array in session variable. I need to pass key strokes to it to return values

  7. 7

    I have a array with 0 and 1 values. If I multiply this with -1, it results in empty array. Why?

  8. 8

    I have an array of URLs that need to be passed into anchor tags

  9. 9

    need to access 3 values in a php array that contains 20, is a 3d array and I need to access the same values 60 times

  10. 10

    I need to add data into an Array

  11. 11

    How can I save values in a array when I have a foreach?

  12. 12

    I need to check a JavaScript array to see if there are any duplicate values.

  13. 13

    Checking values for an array for every $i

  14. 14

    Search multidimensional array and place found values in new array (PHP)

  15. 15

    Do I need to initialise every key of a multidimensional array in PHP?

  16. 16

    I have some remote images I'm loading into an NSMutableArray but the array isn't populated by the time I need it

  17. 17

    I have a single array into multidimensional array

  18. 18

    I have JSON Object, with this object i need to find the ID Number of "xxxEmployeeCategory "T" and list the list in an Array

  19. 19

    How do I go from an array of key => "array of values" to an array of an array of "key => values" in php

  20. 20

    I need to pull an individual string from a PHP array

  21. 21

    I need to create and sort new array with php

  22. 22

    How can I add keys to a PHP array, if I need those keys to have a value (passed from a DB) at the same time?

  23. 23

    I have this query that gives me the following php array data:

  24. 24

    I have passed an array in session variable. I need to pass key strokes to it to return values

  25. 25

    how to get some values of an array php

  26. 26

    I have an array but i want to check it separated

  27. 27

    Loop into an array if I have a key in PHP

  28. 28

    I need to loop this array

  29. 29

    Create new array from two array in with i will count the number of occurence some values in php

HotTag

Archive