
AquariaXI
Members-
Posts
32 -
Joined
-
Last visited
Everything posted by AquariaXI
-
Someone can help? This person obviously doesn't want to really help me...
-
This makes absolutely no sense to me. I learn by example. I simply want to use // Find all <td> whose attribute id="BLAH" $doc = new DOMDocument ( ); $doc -> loadHTMLFile ( 'index.php' ); $child = $doc -> getElementsByTagName ( 'td' ); foreach ( $child as $td ) { if ( $td -> hasAttribute ( 'id' ) ) { echo $td -> attributes -> getNamedItem ( 'id' ) -> nodeValue . '<br>\r\n'; } } Now, this returns "colors" which is the id. not the value OF colors. It also comes with a warning It at least SEEMS to me at the moment at least, that you are simply trying to avoid the answer.
-
I didn't ask you to do it for me. I simply asked for how I can grab getElementFromId data in PHP from jquery using DomDocument...
-
Isn't there a way to use <?php // Create a new DOM Document $dom = new DOMDocument('1.0', 'iso-8859-1'); // Enable validate on parse $dom->validateOnParse = true; // Create a div element $element = $dom->appendChild(new DOMElement('div', 'Hey, this is the text content of the div element.')); // Create a id attribute to div $attr = $element->setAttributeNode( new DOMAttr('id', 'my_id')); // Set that attribute as id $element->setIDAttribute('id', true); // Get the tag content $tagcontent = $dom->getElementById('my_id')->textContent; echo $tagcontent; ?> ? except i don't want a div, i want the td's "shades" & "tints"
-
I don't want to have to submit it. The "Update" button does not "submit", it just instantly changes the hex values.
-
Correct. I just want to echo out the chosen hex values from within the "shades" td & "tints" td id tags When the user interacts with the "Update" button, when they hit it, it changes the tints / shades hex values that are held within the "shades" id & "tints" id td tags.
-
ding ding ding! CORRECT! The user DOES interact with the page to change what values are being shown in the table. anyway, this is the table : <table class="color_frame"> <tr> <td class="picker_box"> <div class="color_wrapper"> <div id="colorpickerHolder"></div> <div class="top_bar"> <div class="color_panel"> <!--Color Panel--> </div> </div> <input type="button" value=" " class="update_btn" /> </div> </td> <td class="color_map"><img src="images/color_map.gif" alt="Shade and Tint map" /></td> <td id="colors" class="shade_box"> <table id="shades"></table> <table id="tints"></table> </td> </tr> </table>
-
function hex2rgb ( hex ) { hex = hex.replace ( '#', '' ); r = parseInt ( hex.substring ( 0, 2 ), 16 ); g = parseInt ( hex.substring ( 2, 4 ), 16 ); b = parseInt ( hex.substring ( 4, 6 ), 16 ); result = 'rgb(' + ( r + ', ' + g + ', ' + b + ')' ); return result; } function rgb2hex ( rgb ) { rgb = rgb.match ( /^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i ); return ( rgb && rgb.length === 4 ) ? "#" + ( "0" + parseInt ( rgb [ 1 ], 10 ).toString ( 16 ) ).slice ( -2 ) + ( "0" + parseInt ( rgb [ 2 ], 10 ).toString ( 16 ) ).slice ( -2 ) + ( "0" + parseInt ( rgb [ 3 ], 10 ).toString ( 16 ) ).slice ( -2 ) : "" } for ( var i = 0; i < 10; i++ ) { var shadeHex = rgb2hex ( String ( 'rgb(' + shades [ 9 - i ].rgb + ')' ) ); var tintHex = rgb2hex ( String ( 'rgb(' + tints [ i ].rgb + ')' ) ); $ ( "#shades" ).append ( '<tr>' + '<td class="hexcolor">' + '<a style="background : ' + shadeHex + '"></a>' + '</td>' + '<td class="hexcode">' + shadeHex + '</td>' + '</tr>' ); $ ( "#tints" ).append ( '<tr>' + '<td class="hexcolor">' + '<a style="background : ' + tintHex + '"></a>' + '</td>' + '<td class="hexcode">' + tintHex + '</td>' + '</tr>' ); } this is my whole jquery code
-
i dont understand... T_T I said the jquery is serving up the tds : $ ( "#shades" ).append ( '<tr>' + '<td class="hexcolor">' + '<a style="background : ' + shadeHex + '"></a>' + '</td>' + '<td class="hexcode">' + shadeHex + '</td>' + '</tr>' );
-
How would YOU do it then? I've been trying to figure out how to grab the `td` `shades` data from php for 18 hours now.
-
Yes & ONLY grab the value{s} between "<td id=\"shades\">DATA HERE</td>" - It is to grab the color hexes from my jquery hex array & echo them out in php. and NO I cannot build the table in PHP. the hex values are generated from jquery ONLY & are put inside the table with the id, "shades"
-
Made a typo HTML [ 0 ] = $string; should be $HTML [ 0 ] = $string;
-
So I'm trying to grab values from a specific table id in html in PHP possibly using `DOMElement` or something else? I want to add my index.php page to a variable, search for a certain table id ( in this case, "shades" ), then grab JUST the values from inside that table & print it out in an echo. Here's what i have. for some reason I'm getting Warning: DOMDocument::loadHTML(): htmlParseEntityRef: no name in Entity <?php $HTML = [ ]; $stream = fopen ( "index.php", "r" ); $string = stream_get_contents ( $stream ); HTML [ 0 ] = $string; // Our HTML goes here $innerHTML = implode ( ',', $HTML ); // Create a new DOMDocument based on our HTML $document = new DOMDocument; $document -> loadHTML ( $innerHTML ); // Get a NodeList of any table "id", "shades" $cells = $document -> getElementsByTagName ( "id" ); // Cycle over each <td>, adding its HTML to $innerHTML foreach ( $cells as $cell ) { $innerHTML = $document -> saveHTML ( $cell ); } // Output our glorious HTML echo $innerHTML; fclose ( $stream ); ?> Any help is absolutely appreciated!
-
Array from comma separated string containing multiple array{s} ?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
Please remove this topic. I was able to fix it myself! -
So I'm trying to create an Array from a comma separated string containing array{s}. How can I take a string full of comma separated hex values such as : <?php $myStr = ( "00ffff", "00cccc", "009999", "007777", "004444", "001111", "01ffff", "01cccc", "019999" ); ?> & turn it into 3 separated arrays like : <?php $myNewArrs = [ Array1 ( 3 ), Array2 ( 3 ), Array3 ( 3 ), ]; ?> which REALLY looks like : <?php $myNewArrs = [ Array ( "00ffff", "00cccc", "009999" ), Array ( "007777", "004444", "001111" ), Array ( "01ffff", "01cccc", "019999" ), ]; ?> ? Any assistance is most-definitely appreciated! Thank you & have a great afternoon!
-
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
Here's what that wrote to the file : ff00ff, ff00cc, ff0099, ff0066, ff0033, ff0000, ff3300, ff6600, ff9900, ffcc00, ffff00, ccff00, 99ff00, 66ff00, 33ff00, 00ff00, 00ff33, 00ff66, 00ff99, 00ffcc, 00ffff, 00ccff, 0099ff, 0066ff, 0033ff, 0000ff, 3300ff, 6600ff, 9900ff, cc00ff, 9900ff, 6600ff, 3300ff, 0000ff, 0033ff, 0066ff, 0099ff, 00ccff, 00ffff, 00ffcc, 00ff99, 00ff66, 00ff33, 00ff00, 33ff00, 66ff00, 99ff00, ccff00, ffff00, ffcc00, ff9900, ff6600, ff3300, ff0000, ff0033, ff0066, ff0099, ff00cc, ff00ff It is all one line. It needs to look exactly like the hex I wrote in the code above. -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
Correct. And yes I've already tried strings, but it's unfortunately only creating 1 long string & plus I need the ability to create as many hex color codes as needed to write to the file. -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
Basically, "ff00ff", "ff00cc", "ff0099", "ff0066", "ff0033", "ff0000", "ff3300", "ff6600", "ff9900", "ffcc00", "ffff00", "ccff00", "99ff00", "66ff00", "33ff00", "00ff00", "00ff33", "00ff66", "00ff99", "00ffcc", "00ffff", "00ccff", "0099ff", "0066ff", "0033ff", "0000ff", "3300ff", "6600ff", "9900ff", "cc00ff", "9900ff", "6600ff", "3300ff", "0000ff", "0033ff", "0066ff", "0099ff", "00ccff", "00ffff", "00ffcc", "00ff99", "00ff66", "00ff33", "00ff00", "33ff00", "66ff00", "99ff00", "ccff00", "ffff00", "ffcc00", "ff9900", "ff6600", "ff3300", "ff0000", "ff0033", "ff0066", "ff0099", "ff00cc", "ff00ff" is what I want to see in the file ( YES, including the double quotes ) & YES, in the format seen above. After every 3rd comma, starts a new line. -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
@requinix Now I think I understand you. If I don't, I apologize in advance. SO.... 1st, here's all the functions used to write to this file ( which is a CSV in this case ) includes/file-mainframe.php : <?php function implodeAll ( $glue, $arr ) { for ( $i = 0; $i < count ( $arr ); $i++ ) { if ( @is_array ( $arr [ $i ] ) ) { $arr [ $i ] = CSV :: implodeAll ( $glue, $arr [ $i ] ); } } } function SplitFileByDelimiter ( $content, $delimiter = ",", $delimCount = 3 ) { $content = [ $content ]; $content = implode ( $delimiter, $content ); return $content; } function checkDelimiter ( $content, $throwExceptionOnNonUnique = true, $expectSingleColumn = false ) { // Would be cleaner if you pass the delimiters from outside // as also the order matters in the special case you've got something like "a,b;c" // & you don't throw the exception - then the first match is prefered // But for StackOverflow I put them inside $delimiters = [ "\t", ";", "|", "," ]; $result = ','; $maxCount = 0; foreach ( $delimiters as $delimiter ) { // Impress your code reviewer by some good regex $pattern = "/(?<!\\\)(?:\\\\\\\)*(?!\B\"[^\\\"]*)\\" . $delimiter . "(?![^\"]*\\\"\B)/"; $amount = preg_match_all ( $pattern, $content ); if ( $maxCount > 0 && $amount > 0 && $throwExceptionOnNonUnique ) { $msg = 'Identifier is not clear : "' . $result . '" & "' . $delimiter . '" are possible'; throw new Exception ( $msg ); } if ( $amount > $maxCount ) { $maxCount = $amount; $result = $delimiter; } } // If nothing matches & you don't expect that just the CSV just // consists of one single column without a delimeter at the end if ( $maxCount === 0 && ! $expectSingleColumn ) { throw new Exception ( 'Unknown delimiter' ); } return $result; } function WriteFile ( $filename, ...$content ) { if ( gettype ( $content ) === 'array' ) { $content = File :: implodeAll ( ', ', $content ); } $list = [ $content ]; $delimiters = File :: checkDelimiter ( $content, true, false ); $fp = fopen ( $filename, 'w' ); foreach ( $list as $fields ) { $fields = File :: SplitFileByDelimiter ( $fields, ",", 3 ); file_put_contents ( $filename, $fields ); } fclose ( $fp ); } function ReadCSV ( $filename ) { // Read a CSV file $handle = fopen ( $filename, "r" ); // Optionally, you can keep the number of the // line of the loop it's currently // iterating over $lineNumber = 1; // Add new Data Array to dump all data $myData = [ ]; // Iterate over every line of the file while ( ( $raw_string = fgets ( $handle ) ) !== false ) { // Parse the raw csv string: "1, a, b, c" $row = str_getcsv ( $raw_string ); $myData = [ $row ]; // into an array: ['1', 'a', 'b', 'c'] // And do what you need to do with every line var_dump ( $myData [ 0 ] ); // Increase the current line $lineNumber++; } fclose ( $handle ); return $myData [ 0 ]; } ?> <?php include_once ( 'includes/file-mainframe.php' ); $file -> WriteFile ( $filepath . $filename, [ "ff00ff", "ff00cc", "ff0099", "ff0066", "ff0033", "ff0000", "ff3300", "ff6600", "ff9900", "ffcc00", "ffff00", "ccff00", "99ff00", "66ff00", "33ff00", "00ff00", "00ff33", "00ff66", "00ff99", "00ffcc", "00ffff", "00ccff", "0099ff", "0066ff", "0033ff", "0000ff", "3300ff", "6600ff", "9900ff", "cc00ff", "9900ff", "6600ff", "3300ff", "0000ff", "0033ff", "0066ff", "0099ff", "00ccff", "00ffff", "00ffcc", "00ff99", "00ff66", "00ff33", "00ff00", "33ff00", "66ff00", "99ff00", "ccff00", "ffff00", "ffcc00", "ff9900", "ff6600", "ff3300", "ff0000", "ff0033", "ff0066", "ff0099", "ff00cc", "ff00ff" ] ); $fileData = $file -> ReadCSV ( $filepath . $filename ); echo var_dump ( $fileData ); die ( ); ?> So when I use this in var_dump ( ), I get array(59) { [0]=> string(6) "ff00ff" [1]=> string(7) " ff00cc" [2]=> string(7) " ff0099" [3]=> string(7) " ff0066" [4]=> string(7) " ff0033" [5]=> string(7) " ff0000" [6]=> string(7) " ff3300" [7]=> string(7) " ff6600" [8]=> string(7) " ff9900" [9]=> string(7) " ffcc00" [10]=> string(7) " ffff00" [11]=> string(7) " ccff00" [12]=> string(7) " 99ff00" [13]=> string(7) " 66ff00" [14]=> string(7) " 33ff00" [15]=> string(7) " 00ff00" [16]=> string(7) " 00ff33" [17]=> string(7) " 00ff66" [18]=> string(7) " 00ff99" [19]=> string(7) " 00ffcc" [20]=> string(7) " 00ffff" [21]=> string(7) " 00ccff" [22]=> string(7) " 0099ff" [23]=> string(7) " 0066ff" [24]=> string(7) " 0033ff" [25]=> string(7) " 0000ff" [26]=> string(7) " 3300ff" [27]=> string(7) " 6600ff" [28]=> string(7) " 9900ff" [29]=> string(7) " cc00ff" [30]=> string(7) " 9900ff" [31]=> string(7) " 6600ff" [32]=> string(7) " 3300ff" [33]=> string(7) " 0000ff" [34]=> string(7) " 0033ff" [35]=> string(7) " 0066ff" [36]=> string(7) " 0099ff" [37]=> string(7) " 00ccff" [38]=> string(7) " 00ffff" [39]=> string(7) " 00ffcc" [40]=> string(7) " 00ff99" [41]=> string(7) " 00ff66" [42]=> string(7) " 00ff33" [43]=> string(7) " 00ff00" [44]=> string(7) " 33ff00" [45]=> string(7) " 66ff00" [46]=> string(7) " 99ff00" [47]=> string(7) " ccff00" [48]=> string(7) " ffff00" [49]=> string(7) " ffcc00" [50]=> string(7) " ff9900" [51]=> string(7) " ff6600" [52]=> string(7) " ff3300" [53]=> string(7) " ff0000" [54]=> string(7) " ff0033" [55]=> string(7) " ff0066" [56]=> string(7) " ff0099" [57]=> string(7) " ff00cc" [58]=> string(7) " ff00ff" } array(59) { [0]=> string(6) "ff00ff" [1]=> string(7) " ff00cc" [2]=> string(7) " ff0099" [3]=> string(7) " ff0066" [4]=> string(7) " ff0033" [5]=> string(7) " ff0000" [6]=> string(7) " ff3300" [7]=> string(7) " ff6600" [8]=> string(7) " ff9900" [9]=> string(7) " ffcc00" [10]=> string(7) " ffff00" [11]=> string(7) " ccff00" [12]=> string(7) " 99ff00" [13]=> string(7) " 66ff00" [14]=> string(7) " 33ff00" [15]=> string(7) " 00ff00" [16]=> string(7) " 00ff33" [17]=> string(7) " 00ff66" [18]=> string(7) " 00ff99" [19]=> string(7) " 00ffcc" [20]=> string(7) " 00ffff" [21]=> string(7) " 00ccff" [22]=> string(7) " 0099ff" [23]=> string(7) " 0066ff" [24]=> string(7) " 0033ff" [25]=> string(7) " 0000ff" [26]=> string(7) " 3300ff" [27]=> string(7) " 6600ff" [28]=> string(7) " 9900ff" [29]=> string(7) " cc00ff" [30]=> string(7) " 9900ff" [31]=> string(7) " 6600ff" [32]=> string(7) " 3300ff" [33]=> string(7) " 0000ff" [34]=> string(7) " 0033ff" [35]=> string(7) " 0066ff" [36]=> string(7) " 0099ff" [37]=> string(7) " 00ccff" [38]=> string(7) " 00ffff" [39]=> string(7) " 00ffcc" [40]=> string(7) " 00ff99" [41]=> string(7) " 00ff66" [42]=> string(7) " 00ff33" [43]=> string(7) " 00ff00" [44]=> string(7) " 33ff00" [45]=> string(7) " 66ff00" [46]=> string(7) " 99ff00" [47]=> string(7) " ccff00" [48]=> string(7) " ffff00" [49]=> string(7) " ffcc00" [50]=> string(7) " ff9900" [51]=> string(7) " ff6600" [52]=> string(7) " ff3300" [53]=> string(7) " ff0000" [54]=> string(7) " ff0033" [55]=> string(7) " ff0066" [56]=> string(7) " ff0099" [57]=> string(7) " ff00cc" [58]=> string(7) " ff00ff" } OR array(59) { [0]=> string(6) "ff00ff" [1]=> string(7) " ff00cc" [2]=> string(7) " ff0099" [3]=> string(7) " ff0066" [4]=> string(7) " ff0033" [5]=> string(7) " ff0000" [6]=> string(7) " ff3300" [7]=> string(7) " ff6600" [8]=> string(7) " ff9900" [9]=> string(7) " ffcc00" [10]=> string(7) " ffff00" [11]=> string(7) " ccff00" [12]=> string(7) " 99ff00" [13]=> string(7) " 66ff00" [14]=> string(7) " 33ff00" [15]=> string(7) " 00ff00" [16]=> string(7) " 00ff33" [17]=> string(7) " 00ff66" [18]=> string(7) " 00ff99" [19]=> string(7) " 00ffcc" [20]=> string(7) " 00ffff" [21]=> string(7) " 00ccff" [22]=> string(7) " 0099ff" [23]=> string(7) " 0066ff" [24]=> string(7) " 0033ff" [25]=> string(7) " 0000ff" [26]=> string(7) " 3300ff" [27]=> string(7) " 6600ff" [28]=> string(7) " 9900ff" [29]=> string(7) " cc00ff" [30]=> string(7) " 9900ff" [31]=> string(7) " 6600ff" [32]=> string(7) " 3300ff" [33]=> string(7) " 0000ff" [34]=> string(7) " 0033ff" [35]=> string(7) " 0066ff" [36]=> string(7) " 0099ff" [37]=> string(7) " 00ccff" [38]=> string(7) " 00ffff" [39]=> string(7) " 00ffcc" [40]=> string(7) " 00ff99" [41]=> string(7) " 00ff66" [42]=> string(7) " 00ff33" [43]=> string(7) " 00ff00" [44]=> string(7) " 33ff00" [45]=> string(7) " 66ff00" [46]=> string(7) " 99ff00" [47]=> string(7) " ccff00" [48]=> string(7) " ffff00" [49]=> string(7) " ffcc00" [50]=> string(7) " ff9900" [51]=> string(7) " ff6600" [52]=> string(7) " ff3300" [53]=> string(7) " ff0000" [54]=> string(7) " ff0033" [55]=> string(7) " ff0066" [56]=> string(7) " ff0099" [57]=> string(7) " ff00cc" [58]=> string(7) " ff00ff" } array(59) { [0]=> string(6) "ff00ff" [1]=> string(7) " ff00cc" [2]=> string(7) " ff0099" [3]=> string(7) " ff0066" [4]=> string(7) " ff0033" [5]=> string(7) " ff0000" [6]=> string(7) " ff3300" [7]=> string(7) " ff6600" [8]=> string(7) " ff9900" [9]=> string(7) " ffcc00" [10]=> string(7) " ffff00" [11]=> string(7) " ccff00" [12]=> string(7) " 99ff00" [13]=> string(7) " 66ff00" [14]=> string(7) " 33ff00" [15]=> string(7) " 00ff00" [16]=> string(7) " 00ff33" [17]=> string(7) " 00ff66" [18]=> string(7) " 00ff99" [19]=> string(7) " 00ffcc" [20]=> string(7) " 00ffff" [21]=> string(7) " 00ccff" [22]=> string(7) " 0099ff" [23]=> string(7) " 0066ff" [24]=> string(7) " 0033ff" [25]=> string(7) " 0000ff" [26]=> string(7) " 3300ff" [27]=> string(7) " 6600ff" [28]=> string(7) " 9900ff" [29]=> string(7) " cc00ff" [30]=> string(7) " 9900ff" [31]=> string(7) " 6600ff" [32]=> string(7) " 3300ff" [33]=> string(7) " 0000ff" [34]=> string(7) " 0033ff" [35]=> string(7) " 0066ff" [36]=> string(7) " 0099ff" [37]=> string(7) " 00ccff" [38]=> string(7) " 00ffff" [39]=> string(7) " 00ffcc" [40]=> string(7) " 00ff99" [41]=> string(7) " 00ff66" [42]=> string(7) " 00ff33" [43]=> string(7) " 00ff00" [44]=> string(7) " 33ff00" [45]=> string(7) " 66ff00" [46]=> string(7) " 99ff00" [47]=> string(7) " ccff00" [48]=> string(7) " ffff00" [49]=> string(7) " ffcc00" [50]=> string(7) " ff9900" [51]=> string(7) " ff6600" [52]=> string(7) " ff3300" [53]=> string(7) " ff0000" [54]=> string(7) " ff0033" [55]=> string(7) " ff0066" [56]=> string(7) " ff0099" [57]=> string(7) " ff00cc" [58]=> string(7) " ff00ff" } I hope this helps! -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
1 ) yes, it is a variable. 2 ) In order to put a real value into it, I need to split it into 3 comma separated lines. I don't know how much more clear I can be. 3 ) As I said before, color hex. -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
@requinix it's just gonna be a bunch of color hex codes. I can't really explain it more than that. -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
Someone can help? -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
@requinix Well yes, it IS supposed to be CSV, but unless I have to, I don't want to use fOpenCSV ( ) or w/e that function is. I just want to turn the raw arrays into a string then split them at their 3rd comma. -
Split array every 3 commas & return as string?
AquariaXI replied to AquariaXI's topic in PHP Coding Help
@requinix function checkDelimiter ( $content, $throwExceptionOnNonUnique = true, $expectSingleColumn = false ) { // Would be cleaner if you pass the delimiters from outside // as also the order matters in the special case you've got something like "a,b;c" // & you don't throw the exception - then the first match is prefered // But for StackOverflow I put them inside $delimiters = [ "\t", ";", "|", "," ]; $result = ','; $maxCount = 0; foreach ( $delimiters as $delimiter ) { // Impress your code reviewer by some good regex $pattern = "/(?<!\\\)(?:\\\\\\\)*(?!\B\"[^\\\"]*)\\" . $delimiter . "(?![^\"]*\\\"\B)/"; $amount = preg_match_all ( $pattern, $content ); if ( $maxCount > 0 && $amount > 0 && $throwExceptionOnNonUnique ) { $msg = 'Identifier is not clear : "' . $result . '" & "' . $delimiter . '" are possible'; throw new Exception ( $msg ); } if ( $amount > $maxCount ) { $maxCount = $amount; $result = $delimiter; } } // If nothing matches & you don't expect that just the value consists of one single column without a delimeter at the end if ( $maxCount === 0 && ! $expectSingleColumn ) { throw new Exception ( 'Unknown delimiter' ); } return $result; } function SplitFileByDelimiter ( $content, $delimiter = ",", $delimCount = 3 ) { // Turn array into string $content = implode ( $delimiter, $content ); return $content; }